@sapiom/harness 0.8.7 → 0.8.8

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.
@@ -0,0 +1,494 @@
1
+ var qk=Object.defineProperty;var Fk=(e,t,i)=>t in e?qk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var $p=(e,t,i)=>Fk(e,typeof t!="symbol"?t+"":t,i);(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 f of c.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&r(f)}).observe(document,{childList:!0,subtree:!0});function i(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=i(o);fetch(o.href,c)}})();function Vk(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Lp={exports:{}},_l={};/**
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 ib;function Wk(){if(ib)return _l;ib=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function i(r,o,c){var f=null;if(c!==void 0&&(f=""+c),o.key!==void 0&&(f=""+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:f,ref:o!==void 0?o:null,props:c}}return _l.Fragment=t,_l.jsx=i,_l.jsxs=i,_l}var nb;function Gk(){return nb||(nb=1,Lp.exports=Wk()),Lp.exports}var h=Gk(),Ip={exports:{}},ot={};/**
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 rb;function Kk(){if(rb)return ot;rb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),f=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),S=Symbol.iterator;function w(D){return D===null||typeof D!="object"?null:(D=S&&D[S]||D["@@iterator"],typeof D=="function"?D:null)}var R={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,g={};function b(D,H,U){this.props=D,this.context=H,this.refs=g,this.updater=U||R}b.prototype.isReactComponent={},b.prototype.setState=function(D,H){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,H,"setState")},b.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function p(){}p.prototype=b.prototype;function _(D,H,U){this.props=D,this.context=H,this.refs=g,this.updater=U||R}var k=_.prototype=new p;k.constructor=_,x(k,b.prototype),k.isPureReactComponent=!0;var A=Array.isArray;function C(){}var N={H:null,A:null,T:null,S:null},j=Object.prototype.hasOwnProperty;function M(D,H,U){var L=U.ref;return{$$typeof:e,type:D,key:H,ref:L!==void 0?L:null,props:U}}function O(D,H){return M(D.type,H,D.props)}function B(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function q(D){var H={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(U){return H[U]})}var V=/\/+/g;function J(D,H){return typeof D=="object"&&D!==null&&D.key!=null?q(""+D.key):H.toString(36)}function ee(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(C,C):(D.status="pending",D.then(function(H){D.status==="pending"&&(D.status="fulfilled",D.value=H)},function(H){D.status==="pending"&&(D.status="rejected",D.reason=H)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function W(D,H,U,L,G){var se=typeof D;(se==="undefined"||se==="boolean")&&(D=null);var Y=!1;if(D===null)Y=!0;else switch(se){case"bigint":case"string":case"number":Y=!0;break;case"object":switch(D.$$typeof){case e:case t:Y=!0;break;case y:return Y=D._init,W(Y(D._payload),H,U,L,G)}}if(Y)return G=G(D),Y=L===""?"."+J(D,0):L,A(G)?(U="",Y!=null&&(U=Y.replace(V,"$&/")+"/"),W(G,H,U,"",function(ae){return ae})):G!=null&&(B(G)&&(G=O(G,U+(G.key==null||D&&D.key===G.key?"":(""+G.key).replace(V,"$&/")+"/")+Y)),H.push(G)),1;Y=0;var F=L===""?".":L+":";if(A(D))for(var le=0;le<D.length;le++)L=D[le],se=F+J(L,le),Y+=W(L,H,U,se,G);else if(le=w(D),typeof le=="function")for(D=le.call(D),le=0;!(L=D.next()).done;)L=L.value,se=F+J(L,le++),Y+=W(L,H,U,se,G);else if(se==="object"){if(typeof D.then=="function")return W(ee(D),H,U,L,G);throw H=String(D),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return Y}function Q(D,H,U){if(D==null)return D;var L=[],G=0;return W(D,L,"","",function(se){return H.call(U,se,G++)}),L}function ie(D){if(D._status===-1){var H=D._result;H=H(),H.then(function(U){(D._status===0||D._status===-1)&&(D._status=1,D._result=U)},function(U){(D._status===0||D._status===-1)&&(D._status=2,D._result=U)}),D._status===-1&&(D._status=0,D._result=H)}if(D._status===1)return D._result.default;throw D._result}var I=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},P={map:Q,forEach:function(D,H,U){Q(D,function(){H.apply(this,arguments)},U)},count:function(D){var H=0;return Q(D,function(){H++}),H},toArray:function(D){return Q(D,function(H){return H})||[]},only:function(D){if(!B(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return ot.Activity=v,ot.Children=P,ot.Component=b,ot.Fragment=i,ot.Profiler=o,ot.PureComponent=_,ot.StrictMode=r,ot.Suspense=d,ot.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,ot.__COMPILER_RUNTIME={__proto__:null,c:function(D){return N.H.useMemoCache(D)}},ot.cache=function(D){return function(){return D.apply(null,arguments)}},ot.cacheSignal=function(){return null},ot.cloneElement=function(D,H,U){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var L=x({},D.props),G=D.key;if(H!=null)for(se in H.key!==void 0&&(G=""+H.key),H)!j.call(H,se)||se==="key"||se==="__self"||se==="__source"||se==="ref"&&H.ref===void 0||(L[se]=H[se]);var se=arguments.length-2;if(se===1)L.children=U;else if(1<se){for(var Y=Array(se),F=0;F<se;F++)Y[F]=arguments[F+2];L.children=Y}return M(D.type,G,L)},ot.createContext=function(D){return D={$$typeof:f,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:c,_context:D},D},ot.createElement=function(D,H,U){var L,G={},se=null;if(H!=null)for(L in H.key!==void 0&&(se=""+H.key),H)j.call(H,L)&&L!=="key"&&L!=="__self"&&L!=="__source"&&(G[L]=H[L]);var Y=arguments.length-2;if(Y===1)G.children=U;else if(1<Y){for(var F=Array(Y),le=0;le<Y;le++)F[le]=arguments[le+2];G.children=F}if(D&&D.defaultProps)for(L in Y=D.defaultProps,Y)G[L]===void 0&&(G[L]=Y[L]);return M(D,se,G)},ot.createRef=function(){return{current:null}},ot.forwardRef=function(D){return{$$typeof:l,render:D}},ot.isValidElement=B,ot.lazy=function(D){return{$$typeof:y,_payload:{_status:-1,_result:D},_init:ie}},ot.memo=function(D,H){return{$$typeof:m,type:D,compare:H===void 0?null:H}},ot.startTransition=function(D){var H=N.T,U={};N.T=U;try{var L=D(),G=N.S;G!==null&&G(U,L),typeof L=="object"&&L!==null&&typeof L.then=="function"&&L.then(C,I)}catch(se){I(se)}finally{H!==null&&U.types!==null&&(H.types=U.types),N.T=H}},ot.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},ot.use=function(D){return N.H.use(D)},ot.useActionState=function(D,H,U){return N.H.useActionState(D,H,U)},ot.useCallback=function(D,H){return N.H.useCallback(D,H)},ot.useContext=function(D){return N.H.useContext(D)},ot.useDebugValue=function(){},ot.useDeferredValue=function(D,H){return N.H.useDeferredValue(D,H)},ot.useEffect=function(D,H){return N.H.useEffect(D,H)},ot.useEffectEvent=function(D){return N.H.useEffectEvent(D)},ot.useId=function(){return N.H.useId()},ot.useImperativeHandle=function(D,H,U){return N.H.useImperativeHandle(D,H,U)},ot.useInsertionEffect=function(D,H){return N.H.useInsertionEffect(D,H)},ot.useLayoutEffect=function(D,H){return N.H.useLayoutEffect(D,H)},ot.useMemo=function(D,H){return N.H.useMemo(D,H)},ot.useOptimistic=function(D,H){return N.H.useOptimistic(D,H)},ot.useReducer=function(D,H,U){return N.H.useReducer(D,H,U)},ot.useRef=function(D){return N.H.useRef(D)},ot.useState=function(D){return N.H.useState(D)},ot.useSyncExternalStore=function(D,H,U){return N.H.useSyncExternalStore(D,H,U)},ot.useTransition=function(){return N.H.useTransition()},ot.version="19.2.7",ot}var ab;function qv(){return ab||(ab=1,Ip.exports=Kk()),Ip.exports}var z=qv(),Pp={exports:{}},yl={},Bp={exports:{}},Hp={};/**
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 ob;function Yk(){return ob||(ob=1,(function(e){function t(W,Q){var ie=W.length;W.push(Q);e:for(;0<ie;){var I=ie-1>>>1,P=W[I];if(0<o(P,Q))W[I]=Q,W[ie]=P,ie=I;else break e}}function i(W){return W.length===0?null:W[0]}function r(W){if(W.length===0)return null;var Q=W[0],ie=W.pop();if(ie!==Q){W[0]=ie;e:for(var I=0,P=W.length,D=P>>>1;I<D;){var H=2*(I+1)-1,U=W[H],L=H+1,G=W[L];if(0>o(U,ie))L<P&&0>o(G,U)?(W[I]=G,W[L]=ie,I=L):(W[I]=U,W[H]=ie,I=H);else if(L<P&&0>o(G,ie))W[I]=G,W[L]=ie,I=L;else break e}}return Q}function o(W,Q){var ie=W.sortIndex-Q.sortIndex;return ie!==0?ie:W.id-Q.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 f=Date,l=f.now();e.unstable_now=function(){return f.now()-l}}var d=[],m=[],y=1,v=null,S=3,w=!1,R=!1,x=!1,g=!1,b=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function k(W){for(var Q=i(m);Q!==null;){if(Q.callback===null)r(m);else if(Q.startTime<=W)r(m),Q.sortIndex=Q.expirationTime,t(d,Q);else break;Q=i(m)}}function A(W){if(x=!1,k(W),!R)if(i(d)!==null)R=!0,C||(C=!0,q());else{var Q=i(m);Q!==null&&ee(A,Q.startTime-W)}}var C=!1,N=-1,j=5,M=-1;function O(){return g?!0:!(e.unstable_now()-M<j)}function B(){if(g=!1,C){var W=e.unstable_now();M=W;var Q=!0;try{e:{R=!1,x&&(x=!1,p(N),N=-1),w=!0;var ie=S;try{t:{for(k(W),v=i(d);v!==null&&!(v.expirationTime>W&&O());){var I=v.callback;if(typeof I=="function"){v.callback=null,S=v.priorityLevel;var P=I(v.expirationTime<=W);if(W=e.unstable_now(),typeof P=="function"){v.callback=P,k(W),Q=!0;break t}v===i(d)&&r(d),k(W)}else r(d);v=i(d)}if(v!==null)Q=!0;else{var D=i(m);D!==null&&ee(A,D.startTime-W),Q=!1}}break e}finally{v=null,S=ie,w=!1}Q=void 0}}finally{Q?q():C=!1}}}var q;if(typeof _=="function")q=function(){_(B)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,J=V.port2;V.port1.onmessage=B,q=function(){J.postMessage(null)}}else q=function(){b(B,0)};function ee(W,Q){N=b(function(){W(e.unstable_now())},Q)}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(W){W.callback=null},e.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<W?Math.floor(1e3/W):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(W){switch(S){case 1:case 2:case 3:var Q=3;break;default:Q=S}var ie=S;S=Q;try{return W()}finally{S=ie}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(W,Q){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var ie=S;S=W;try{return Q()}finally{S=ie}},e.unstable_scheduleCallback=function(W,Q,ie){var I=e.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0<ie?I+ie:I):ie=I,W){case 1:var P=-1;break;case 2:P=250;break;case 5:P=1073741823;break;case 4:P=1e4;break;default:P=5e3}return P=ie+P,W={id:y++,callback:Q,priorityLevel:W,startTime:ie,expirationTime:P,sortIndex:-1},ie>I?(W.sortIndex=ie,t(m,W),i(d)===null&&W===i(m)&&(x?(p(N),N=-1):x=!0,ee(A,ie-I))):(W.sortIndex=P,t(d,W),R||w||(R=!0,C||(C=!0,q()))),W},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(W){var Q=S;return function(){var ie=S;S=Q;try{return W.apply(this,arguments)}finally{S=ie}}}})(Hp)),Hp}var lb;function Xk(){return lb||(lb=1,Bp.exports=Yk()),Bp.exports}var zp={exports:{}},Xs={};/**
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 cb;function Jk(){if(cb)return Xs;cb=1;var e=qv();function t(d){var m="https://react.dev/errors/"+d;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+d+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var r={d:{f:i,r:function(){throw Error(t(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(d,m,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:v==null?null:""+v,children:d,containerInfo:m,implementation:y}}var f=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(d,m){if(d==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Xs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Xs.createPortal=function(d,m){var y=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(d,m,null,y)},Xs.flushSync=function(d){var m=f.T,y=r.p;try{if(f.T=null,r.p=2,d)return d()}finally{f.T=m,r.p=y,r.d.f()}},Xs.preconnect=function(d,m){typeof d=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(d,m))},Xs.prefetchDNS=function(d){typeof d=="string"&&r.d.D(d)},Xs.preinit=function(d,m){if(typeof d=="string"&&m&&typeof m.as=="string"){var y=m.as,v=l(y,m.crossOrigin),S=typeof m.integrity=="string"?m.integrity:void 0,w=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;y==="style"?r.d.S(d,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:v,integrity:S,fetchPriority:w}):y==="script"&&r.d.X(d,{crossOrigin:v,integrity:S,fetchPriority:w,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Xs.preinitModule=function(d,m){if(typeof d=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var y=l(m.as,m.crossOrigin);r.d.M(d,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(d)},Xs.preload=function(d,m){if(typeof d=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var y=m.as,v=l(y,m.crossOrigin);r.d.L(d,y,{crossOrigin:v,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})}},Xs.preloadModule=function(d,m){if(typeof d=="string")if(m){var y=l(m.as,m.crossOrigin);r.d.m(d,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(d)},Xs.requestFormReset=function(d){r.d.r(d)},Xs.unstable_batchedUpdates=function(d,m){return d(m)},Xs.useFormState=function(d,m,y){return f.H.useFormState(d,m,y)},Xs.useFormStatus=function(){return f.H.useHostTransitionStatus()},Xs.version="19.2.7",Xs}var ub;function Fw(){if(ub)return zp.exports;ub=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(),zp.exports=Jk(),zp.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 db;function Zk(){if(db)return yl;db=1;var e=Xk(),t=qv(),i=Fw();function r(s){var n="https://react.dev/errors/"+s;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+s+"; visit "+n+" 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 n=s,a=s;if(s.alternate)for(;n.return;)n=n.return;else{s=n;do n=s,(n.flags&4098)!==0&&(a=n.return),s=n.return;while(s)}return n.tag===3?a:null}function f(s){if(s.tag===13){var n=s.memoizedState;if(n===null&&(s=s.alternate,s!==null&&(n=s.memoizedState)),n!==null)return n.dehydrated}return null}function l(s){if(s.tag===31){var n=s.memoizedState;if(n===null&&(s=s.alternate,s!==null&&(n=s.memoizedState)),n!==null)return n.dehydrated}return null}function d(s){if(c(s)!==s)throw Error(r(188))}function m(s){var n=s.alternate;if(!n){if(n=c(s),n===null)throw Error(r(188));return n!==s?null:s}for(var a=s,u=n;;){var E=a.return;if(E===null)break;var T=E.alternate;if(T===null){if(u=E.return,u!==null){a=u;continue}break}if(E.child===T.child){for(T=E.child;T;){if(T===a)return d(E),s;if(T===u)return d(E),n;T=T.sibling}throw Error(r(188))}if(a.return!==u.return)a=E,u=T;else{for(var $=!1,K=E.child;K;){if(K===a){$=!0,a=E,u=T;break}if(K===u){$=!0,u=E,a=T;break}K=K.sibling}if(!$){for(K=T.child;K;){if(K===a){$=!0,a=T,u=E;break}if(K===u){$=!0,u=T,a=E;break}K=K.sibling}if(!$)throw Error(r(189))}}if(a.alternate!==u)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?s:n}function y(s){var n=s.tag;if(n===5||n===26||n===27||n===6)return s;for(s=s.child;s!==null;){if(n=y(s),n!==null)return n;s=s.sibling}return null}var v=Object.assign,S=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),R=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),p=Symbol.for("react.consumer"),_=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),O=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function q(s){return s===null||typeof s!="object"?null:(s=B&&s[B]||s["@@iterator"],typeof s=="function"?s:null)}var V=Symbol.for("react.client.reference");function J(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===V?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case x:return"Fragment";case b:return"Profiler";case g:return"StrictMode";case A:return"Suspense";case C:return"SuspenseList";case M:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case R:return"Portal";case _:return s.displayName||"Context";case p:return(s._context.displayName||"Context")+".Consumer";case k:var n=s.render;return s=s.displayName,s||(s=n.displayName||n.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case N:return n=s.displayName||null,n!==null?n:J(s.type)||"Memo";case j:n=s._payload,s=s._init;try{return J(s(n))}catch{}}return null}var ee=Array.isArray,W=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},I=[],P=-1;function D(s){return{current:s}}function H(s){0>P||(s.current=I[P],I[P]=null,P--)}function U(s,n){P++,I[P]=s.current,s.current=n}var L=D(null),G=D(null),se=D(null),Y=D(null);function F(s,n){switch(U(se,n),U(G,s),U(L,null),n.nodeType){case 9:case 11:s=(s=n.documentElement)&&(s=s.namespaceURI)?ky(s):0;break;default:if(s=n.tagName,n=n.namespaceURI)n=ky(n),s=Ay(n,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}H(L),U(L,s)}function le(){H(L),H(G),H(se)}function ae(s){s.memoizedState!==null&&U(Y,s);var n=L.current,a=Ay(n,s.type);n!==a&&(U(G,s),U(L,a))}function X(s){G.current===s&&(H(L),H(G)),Y.current===s&&(H(Y),pl._currentValue=ie)}var te,ue;function me(s){if(te===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);te=n&&n[1]||"",ue=-1<a.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+te+s+ue}var je=!1;function Oe(s,n){if(!s||je)return"";je=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(n){var ke=function(){throw Error()};if(Object.defineProperty(ke.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ke,[])}catch(be){var ge=be}Reflect.construct(s,[],ke)}else{try{ke.call()}catch(be){ge=be}s.call(ke.prototype)}}else{try{throw Error()}catch(be){ge=be}(ke=s())&&typeof ke.catch=="function"&&ke.catch(function(){})}}catch(be){if(be&&ge&&typeof be.stack=="string")return[be.stack,ge.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var E=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");E&&E.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var T=u.DetermineComponentFrameRoot(),$=T[0],K=T[1];if($&&K){var ne=$.split(`
44
+ `),pe=K.split(`
45
+ `);for(E=u=0;u<ne.length&&!ne[u].includes("DetermineComponentFrameRoot");)u++;for(;E<pe.length&&!pe[E].includes("DetermineComponentFrameRoot");)E++;if(u===ne.length||E===pe.length)for(u=ne.length-1,E=pe.length-1;1<=u&&0<=E&&ne[u]!==pe[E];)E--;for(;1<=u&&0<=E;u--,E--)if(ne[u]!==pe[E]){if(u!==1||E!==1)do if(u--,E--,0>E||ne[u]!==pe[E]){var we=`
46
+ `+ne[u].replace(" at new "," at ");return s.displayName&&we.includes("<anonymous>")&&(we=we.replace("<anonymous>",s.displayName)),we}while(1<=u&&0<=E);break}}}finally{je=!1,Error.prepareStackTrace=a}return(a=s?s.displayName||s.name:"")?me(a):""}function Le(s,n){switch(s.tag){case 26:case 27:case 5:return me(s.type);case 16:return me("Lazy");case 13:return s.child!==n&&n!==null?me("Suspense Fallback"):me("Suspense");case 19:return me("SuspenseList");case 0:case 15:return Oe(s.type,!1);case 11:return Oe(s.type.render,!1);case 1:return Oe(s.type,!0);case 31:return me("Activity");default:return""}}function at(s){try{var n="",a=null;do n+=Le(s,a),a=s,s=s.return;while(s);return n}catch(u){return`
47
+ Error generating stack: `+u.message+`
48
+ `+u.stack}}var Ee=Object.prototype.hasOwnProperty,qe=e.unstable_scheduleCallback,We=e.unstable_cancelCallback,it=e.unstable_shouldYield,Ze=e.unstable_requestPaint,Je=e.unstable_now,wt=e.unstable_getCurrentPriorityLevel,mt=e.unstable_ImmediatePriority,Qt=e.unstable_UserBlockingPriority,Mt=e.unstable_NormalPriority,At=e.unstable_LowPriority,hs=e.unstable_IdlePriority,Ft=e.log,pt=e.unstable_setDisableYieldValue,xs=null,Lt=null;function Ns(s){if(typeof Ft=="function"&&pt(s),Lt&&typeof Lt.setStrictMode=="function")try{Lt.setStrictMode(xs,s)}catch{}}var fs=Math.clz32?Math.clz32:_s,jt=Math.log,ps=Math.LN2;function _s(s){return s>>>=0,s===0?32:31-(jt(s)/ps|0)|0}var Qs=256,ei=262144,Ks=4194304;function $s(s){var n=s&42;if(n!==0)return n;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 gi(s,n,a){var u=s.pendingLanes;if(u===0)return 0;var E=0,T=s.suspendedLanes,$=s.pingedLanes;s=s.warmLanes;var K=u&134217727;return K!==0?(u=K&~T,u!==0?E=$s(u):($&=K,$!==0?E=$s($):a||(a=K&~s,a!==0&&(E=$s(a))))):(K=u&~T,K!==0?E=$s(K):$!==0?E=$s($):a||(a=u&~s,a!==0&&(E=$s(a)))),E===0?0:n!==0&&n!==E&&(n&T)===0&&(T=E&-E,a=n&-n,T>=a||T===32&&(a&4194048)!==0)?n:E}function ds(s,n){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&n)===0}function Ls(s,n){switch(s){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 _i(){var s=Ks;return Ks<<=1,(Ks&62914560)===0&&(Ks=4194304),s}function ys(s){for(var n=[],a=0;31>a;a++)n.push(s);return n}function Ae(s,n){s.pendingLanes|=n,n!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Pe(s,n,a,u,E,T){var $=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,ne=s.expirationTimes,pe=s.hiddenUpdates;for(a=$&~a;0<a;){var we=31-fs(a),ke=1<<we;K[we]=0,ne[we]=-1;var ge=pe[we];if(ge!==null)for(pe[we]=null,we=0;we<ge.length;we++){var be=ge[we];be!==null&&(be.lane&=-536870913)}a&=~ke}u!==0&&Qe(s,u,0),T!==0&&E===0&&s.tag!==0&&(s.suspendedLanes|=T&~($&~n))}function Qe(s,n,a){s.pendingLanes|=n,s.suspendedLanes&=~n;var u=31-fs(n);s.entangledLanes|=n,s.entanglements[u]=s.entanglements[u]|1073741824|a&261930}function Ms(s,n){var a=s.entangledLanes|=n;for(s=s.entanglements;a;){var u=31-fs(a),E=1<<u;E&n|s[u]&n&&(s[u]|=n),a&=~E}}function Is(s,n){var a=n&-n;return a=(a&42)!==0?1:Cs(a),(a&(s.suspendedLanes|n))!==0?0:a}function Cs(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 sn(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Di(){var s=Q.p;return s!==0?s:(s=window.event,s===void 0?32:Xy(s.type))}function li(s,n){var a=Q.p;try{return Q.p=s,n()}finally{Q.p=a}}var oe=Math.random().toString(36).slice(2),fe="__reactFiber$"+oe,ye="__reactProps$"+oe,xe="__reactContainer$"+oe,Te="__reactEvents$"+oe,ct="__reactListeners$"+oe,xt="__reactHandles$"+oe,Dt="__reactResources$"+oe,Rt="__reactMarker$"+oe;function Ct(s){delete s[fe],delete s[ye],delete s[Te],delete s[ct],delete s[xt]}function ve(s){var n=s[fe];if(n)return n;for(var a=s.parentNode;a;){if(n=a[xe]||a[fe]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(s=Oy(s);s!==null;){if(a=s[fe])return a;s=Oy(s)}return n}s=a,a=s.parentNode}return null}function $e(s){if(s=s[fe]||s[xe]){var n=s.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return s}return null}function Be(s){var n=s.tag;if(n===5||n===26||n===27||n===6)return s.stateNode;throw Error(r(33))}function Fe(s){var n=s[Dt];return n||(n=s[Dt]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Ke(s){s[Rt]=!0}var es=new Set,Ye={};function ts(s,n){et(s,n),et(s+"Capture",n)}function et(s,n){for(Ye[s]=n,s=0;s<n.length;s++)es.add(n[s])}var dt=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]*$"),It={},Ys={};function nn(s){return Ee.call(Ys,s)?!0:Ee.call(It,s)?!1:dt.test(s)?Ys[s]=!0:(It[s]=!0,!1)}function pn(s,n,a){if(nn(n))if(a===null)s.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":s.removeAttribute(n);return;case"boolean":var u=n.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){s.removeAttribute(n);return}}s.setAttribute(n,""+a)}}function ua(s,n,a){if(a===null)s.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(n);return}s.setAttribute(n,""+a)}}function yi(s,n,a,u){if(u===null)s.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(a);return}s.setAttributeNS(n,a,""+u)}}function ti(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function oc(s){var n=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function lc(s,n,a){var u=Object.getOwnPropertyDescriptor(s.constructor.prototype,n);if(!s.hasOwnProperty(n)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var E=u.get,T=u.set;return Object.defineProperty(s,n,{configurable:!0,get:function(){return E.call(this)},set:function($){a=""+$,T.call(this,$)}}),Object.defineProperty(s,n,{enumerable:u.enumerable}),{getValue:function(){return a},setValue:function($){a=""+$},stopTracking:function(){s._valueTracker=null,delete s[n]}}}}function Co(s){if(!s._valueTracker){var n=oc(s)?"checked":"value";s._valueTracker=lc(s,n,""+s[n])}}function Eo(s){if(!s)return!1;var n=s._valueTracker;if(!n)return!0;var a=n.getValue(),u="";return s&&(u=oc(s)?s.checked?"true":"false":s.value),s=u,s!==a?(n.setValue(s),!0):!1}function da(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 ha=/[\n"\\]/g;function si(s){return s.replace(ha,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function ko(s,n,a,u,E,T,$,K){s.name="",$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?s.type=$:s.removeAttribute("type"),n!=null?$==="number"?(n===0&&s.value===""||s.value!=n)&&(s.value=""+ti(n)):s.value!==""+ti(n)&&(s.value=""+ti(n)):$!=="submit"&&$!=="reset"||s.removeAttribute("value"),n!=null?fa(s,$,ti(n)):a!=null?fa(s,$,ti(a)):u!=null&&s.removeAttribute("value"),E==null&&T!=null&&(s.defaultChecked=!!T),E!=null&&(s.checked=E&&typeof E!="function"&&typeof E!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?s.name=""+ti(K):s.removeAttribute("name")}function cc(s,n,a,u,E,T,$,K){if(T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(s.type=T),n!=null||a!=null){if(!(T!=="submit"&&T!=="reset"||n!=null)){Co(s);return}a=a!=null?""+ti(a):"",n=n!=null?""+ti(n):a,K||n===s.value||(s.value=n),s.defaultValue=n}u=u??E,u=typeof u!="function"&&typeof u!="symbol"&&!!u,s.checked=K?s.checked:!!u,s.defaultChecked=!!u,$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"&&(s.name=$),Co(s)}function fa(s,n,a){n==="number"&&da(s.ownerDocument)===s||s.defaultValue===""+a||(s.defaultValue=""+a)}function mn(s,n,a,u){if(s=s.options,n){n={};for(var E=0;E<a.length;E++)n["$"+a[E]]=!0;for(a=0;a<s.length;a++)E=n.hasOwnProperty("$"+s[a].value),s[a].selected!==E&&(s[a].selected=E),E&&u&&(s[a].defaultSelected=!0)}else{for(a=""+ti(a),n=null,E=0;E<s.length;E++){if(s[E].value===a){s[E].selected=!0,u&&(s[E].defaultSelected=!0);return}n!==null||s[E].disabled||(n=s[E])}n!==null&&(n.selected=!0)}}function Ao(s,n,a){if(n!=null&&(n=""+ti(n),n!==s.value&&(s.value=n),a==null)){s.defaultValue!==n&&(s.defaultValue=n);return}s.defaultValue=a!=null?""+ti(a):""}function jo(s,n,a,u){if(n==null){if(u!=null){if(a!=null)throw Error(r(92));if(ee(u)){if(1<u.length)throw Error(r(93));u=u[0]}a=u}a==null&&(a=""),n=a}a=ti(n),s.defaultValue=a,u=s.textContent,u===a&&u!==""&&u!==null&&(s.value=u),Co(s)}function vn(s,n){if(n){var a=s.firstChild;if(a&&a===s.lastChild&&a.nodeType===3){a.nodeValue=n;return}}s.textContent=n}var uc=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 Ro(s,n,a){var u=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?u?s.setProperty(n,""):n==="float"?s.cssFloat="":s[n]="":u?s.setProperty(n,a):typeof a!="number"||a===0||uc.has(n)?n==="float"?s.cssFloat=a:s[n]=(""+a).trim():s[n]=a+"px"}function To(s,n,a){if(n!=null&&typeof n!="object")throw Error(r(62));if(s=s.style,a!=null){for(var u in a)!a.hasOwnProperty(u)||n!=null&&n.hasOwnProperty(u)||(u.indexOf("--")===0?s.setProperty(u,""):u==="float"?s.cssFloat="":s[u]="");for(var E in n)u=n[E],n.hasOwnProperty(E)&&a[E]!==u&&Ro(s,E,u)}else for(var T in n)n.hasOwnProperty(T)&&Ro(s,T,n[T])}function pa(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 dc=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"]]),hc=/^[\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 Er(s){return hc.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Oi(){}var ma=null;function va(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var gn=null,_n=null;function No(s){var n=$e(s);if(n&&(s=n.stateNode)){var a=s[ye]||null;e:switch(s=n.stateNode,n.type){case"input":if(ko(s,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=s;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+si(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var u=a[n];if(u!==s&&u.form===s.form){var E=u[ye]||null;if(!E)throw Error(r(90));ko(u,E.value,E.defaultValue,E.defaultValue,E.checked,E.defaultChecked,E.type,E.name)}}for(n=0;n<a.length;n++)u=a[n],u.form===s.form&&Eo(u)}break e;case"textarea":Ao(s,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&mn(s,!!a.multiple,n,!1)}}}var ga=!1;function Mo(s,n,a){if(ga)return s(n,a);ga=!0;try{var u=s(n);return u}finally{if(ga=!1,(gn!==null||_n!==null)&&(Jc(),gn&&(n=gn,s=_n,_n=gn=null,No(n),s)))for(n=0;n<s.length;n++)No(s[n])}}function Jn(s,n){var a=s.stateNode;if(a===null)return null;var u=a[ye]||null;if(u===null)return null;a=u[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(s=s.type,u=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!u;break e;default:s=!1}if(s)return null;if(a&&typeof a!="function")throw Error(r(231,n,typeof a));return a}var Z=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Se=!1;if(Z)try{var Ne={};Object.defineProperty(Ne,"passive",{get:function(){Se=!0}}),window.addEventListener("test",Ne,Ne),window.removeEventListener("test",Ne,Ne)}catch{Se=!1}var ze=null,Et=null,ms=null;function Es(){if(ms)return ms;var s,n=Et,a=n.length,u,E="value"in ze?ze.value:ze.textContent,T=E.length;for(s=0;s<a&&n[s]===E[s];s++);var $=a-s;for(u=1;u<=$&&n[a-u]===E[T-u];u++);return ms=E.slice(s,1<u?1-u:void 0)}function kr(s){var n=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&n===13&&(s=13)):s=n,s===10&&(s=13),32<=s||s===13?s:0}function fc(){return!0}function jg(){return!1}function ci(s){function n(a,u,E,T,$){this._reactName=a,this._targetInst=E,this.type=u,this.nativeEvent=T,this.target=$,this.currentTarget=null;for(var K in s)s.hasOwnProperty(K)&&(a=s[K],this[K]=a?a(T):T[K]);return this.isDefaultPrevented=(T.defaultPrevented!=null?T.defaultPrevented:T.returnValue===!1)?fc:jg,this.isPropagationStopped=jg,this}return v(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=fc)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=fc)},persist:function(){},isPersistent:fc}),n}var Ar={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pc=ci(Ar),Do=v({},Ar,{view:0,detail:0}),z2=ci(Do),Lh,Ih,Oo,mc=v({},Do,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bh,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!==Oo&&(Oo&&s.type==="mousemove"?(Lh=s.screenX-Oo.screenX,Ih=s.screenY-Oo.screenY):Ih=Lh=0,Oo=s),Lh)},movementY:function(s){return"movementY"in s?s.movementY:Ih}}),Rg=ci(mc),U2=v({},mc,{dataTransfer:0}),q2=ci(U2),F2=v({},Do,{relatedTarget:0}),Ph=ci(F2),V2=v({},Ar,{animationName:0,elapsedTime:0,pseudoElement:0}),W2=ci(V2),G2=v({},Ar,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),K2=ci(G2),Y2=v({},Ar,{data:0}),Tg=ci(Y2),X2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},J2={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"},Z2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Q2(s){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(s):(s=Z2[s])?!!n[s]:!1}function Bh(){return Q2}var eE=v({},Do,{key:function(s){if(s.key){var n=X2[s.key]||s.key;if(n!=="Unidentified")return n}return s.type==="keypress"?(s=kr(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?J2[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bh,charCode:function(s){return s.type==="keypress"?kr(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?kr(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),tE=ci(eE),sE=v({},mc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ng=ci(sE),iE=v({},Do,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bh}),nE=ci(iE),rE=v({},Ar,{propertyName:0,elapsedTime:0,pseudoElement:0}),aE=ci(rE),oE=v({},mc,{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}),lE=ci(oE),cE=v({},Ar,{newState:0,oldState:0}),uE=ci(cE),dE=[9,13,27,32],Hh=Z&&"CompositionEvent"in window,$o=null;Z&&"documentMode"in document&&($o=document.documentMode);var hE=Z&&"TextEvent"in window&&!$o,Mg=Z&&(!Hh||$o&&8<$o&&11>=$o),Dg=" ",Og=!1;function $g(s,n){switch(s){case"keyup":return dE.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lg(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var _a=!1;function fE(s,n){switch(s){case"compositionend":return Lg(n);case"keypress":return n.which!==32?null:(Og=!0,Dg);case"textInput":return s=n.data,s===Dg&&Og?null:s;default:return null}}function pE(s,n){if(_a)return s==="compositionend"||!Hh&&$g(s,n)?(s=Es(),ms=Et=ze=null,_a=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Mg&&n.locale!=="ko"?null:n.data;default:return null}}var mE={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 Ig(s){var n=s&&s.nodeName&&s.nodeName.toLowerCase();return n==="input"?!!mE[s.type]:n==="textarea"}function Pg(s,n,a,u){gn?_n?_n.push(u):_n=[u]:gn=u,n=nu(n,"onChange"),0<n.length&&(a=new pc("onChange","change",null,a,u),s.push({event:a,listeners:n}))}var Lo=null,Io=null;function vE(s){by(s,0)}function vc(s){var n=Be(s);if(Eo(n))return s}function Bg(s,n){if(s==="change")return n}var Hg=!1;if(Z){var zh;if(Z){var Uh="oninput"in document;if(!Uh){var zg=document.createElement("div");zg.setAttribute("oninput","return;"),Uh=typeof zg.oninput=="function"}zh=Uh}else zh=!1;Hg=zh&&(!document.documentMode||9<document.documentMode)}function Ug(){Lo&&(Lo.detachEvent("onpropertychange",qg),Io=Lo=null)}function qg(s){if(s.propertyName==="value"&&vc(Io)){var n=[];Pg(n,Io,s,va(s)),Mo(vE,n)}}function gE(s,n,a){s==="focusin"?(Ug(),Lo=n,Io=a,Lo.attachEvent("onpropertychange",qg)):s==="focusout"&&Ug()}function _E(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return vc(Io)}function yE(s,n){if(s==="click")return vc(n)}function bE(s,n){if(s==="input"||s==="change")return vc(n)}function SE(s,n){return s===n&&(s!==0||1/s===1/n)||s!==s&&n!==n}var bi=typeof Object.is=="function"?Object.is:SE;function Po(s,n){if(bi(s,n))return!0;if(typeof s!="object"||s===null||typeof n!="object"||n===null)return!1;var a=Object.keys(s),u=Object.keys(n);if(a.length!==u.length)return!1;for(u=0;u<a.length;u++){var E=a[u];if(!Ee.call(n,E)||!bi(s[E],n[E]))return!1}return!0}function Fg(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Vg(s,n){var a=Fg(s);s=0;for(var u;a;){if(a.nodeType===3){if(u=s+a.textContent.length,s<=n&&u>=n)return{node:a,offset:n-s};s=u}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Fg(a)}}function Wg(s,n){return s&&n?s===n?!0:s&&s.nodeType===3?!1:n&&n.nodeType===3?Wg(s,n.parentNode):"contains"in s?s.contains(n):s.compareDocumentPosition?!!(s.compareDocumentPosition(n)&16):!1:!1}function Gg(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var n=da(s.document);n instanceof s.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)s=n.contentWindow;else break;n=da(s.document)}return n}function qh(s){var n=s&&s.nodeName&&s.nodeName.toLowerCase();return n&&(n==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||n==="textarea"||s.contentEditable==="true")}var wE=Z&&"documentMode"in document&&11>=document.documentMode,ya=null,Fh=null,Bo=null,Vh=!1;function Kg(s,n,a){var u=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Vh||ya==null||ya!==da(u)||(u=ya,"selectionStart"in u&&qh(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Bo&&Po(Bo,u)||(Bo=u,u=nu(Fh,"onSelect"),0<u.length&&(n=new pc("onSelect","select",null,n,a),s.push({event:n,listeners:u}),n.target=ya)))}function jr(s,n){var a={};return a[s.toLowerCase()]=n.toLowerCase(),a["Webkit"+s]="webkit"+n,a["Moz"+s]="moz"+n,a}var ba={animationend:jr("Animation","AnimationEnd"),animationiteration:jr("Animation","AnimationIteration"),animationstart:jr("Animation","AnimationStart"),transitionrun:jr("Transition","TransitionRun"),transitionstart:jr("Transition","TransitionStart"),transitioncancel:jr("Transition","TransitionCancel"),transitionend:jr("Transition","TransitionEnd")},Wh={},Yg={};Z&&(Yg=document.createElement("div").style,"AnimationEvent"in window||(delete ba.animationend.animation,delete ba.animationiteration.animation,delete ba.animationstart.animation),"TransitionEvent"in window||delete ba.transitionend.transition);function Rr(s){if(Wh[s])return Wh[s];if(!ba[s])return s;var n=ba[s],a;for(a in n)if(n.hasOwnProperty(a)&&a in Yg)return Wh[s]=n[a];return s}var Xg=Rr("animationend"),Jg=Rr("animationiteration"),Zg=Rr("animationstart"),xE=Rr("transitionrun"),CE=Rr("transitionstart"),EE=Rr("transitioncancel"),Qg=Rr("transitionend"),e_=new Map,Gh="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(" ");Gh.push("scrollEnd");function Gi(s,n){e_.set(s,n),ts(n,[s])}var gc=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=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(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},$i=[],Sa=0,Kh=0;function _c(){for(var s=Sa,n=Kh=Sa=0;n<s;){var a=$i[n];$i[n++]=null;var u=$i[n];$i[n++]=null;var E=$i[n];$i[n++]=null;var T=$i[n];if($i[n++]=null,u!==null&&E!==null){var $=u.pending;$===null?E.next=E:(E.next=$.next,$.next=E),u.pending=E}T!==0&&t_(a,E,T)}}function yc(s,n,a,u){$i[Sa++]=s,$i[Sa++]=n,$i[Sa++]=a,$i[Sa++]=u,Kh|=u,s.lanes|=u,s=s.alternate,s!==null&&(s.lanes|=u)}function Yh(s,n,a,u){return yc(s,n,a,u),bc(s)}function Tr(s,n){return yc(s,null,null,n),bc(s)}function t_(s,n,a){s.lanes|=a;var u=s.alternate;u!==null&&(u.lanes|=a);for(var E=!1,T=s.return;T!==null;)T.childLanes|=a,u=T.alternate,u!==null&&(u.childLanes|=a),T.tag===22&&(s=T.stateNode,s===null||s._visibility&1||(E=!0)),s=T,T=T.return;return s.tag===3?(T=s.stateNode,E&&n!==null&&(E=31-fs(a),s=T.hiddenUpdates,u=s[E],u===null?s[E]=[n]:u.push(n),n.lane=a|536870912),T):null}function bc(s){if(50<ol)throw ol=0,rp=null,Error(r(185));for(var n=s.return;n!==null;)s=n,n=s.return;return s.tag===3?s.stateNode:null}var wa={};function kE(s,n,a,u){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=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Si(s,n,a,u){return new kE(s,n,a,u)}function Xh(s){return s=s.prototype,!(!s||!s.isReactComponent)}function yn(s,n){var a=s.alternate;return a===null?(a=Si(s.tag,n,s.key,s.mode),a.elementType=s.elementType,a.type=s.type,a.stateNode=s.stateNode,a.alternate=s,s.alternate=a):(a.pendingProps=n,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,n=s.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=s.sibling,a.index=s.index,a.ref=s.ref,a.refCleanup=s.refCleanup,a}function s_(s,n){s.flags&=65011714;var a=s.alternate;return a===null?(s.childLanes=0,s.lanes=n,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,n=a.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),s}function Sc(s,n,a,u,E,T){var $=0;if(u=s,typeof s=="function")Xh(s)&&($=1);else if(typeof s=="string")$=Nk(s,a,L.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case M:return s=Si(31,a,n,E),s.elementType=M,s.lanes=T,s;case x:return Nr(a.children,E,T,n);case g:$=8,E|=24;break;case b:return s=Si(12,a,n,E|2),s.elementType=b,s.lanes=T,s;case A:return s=Si(13,a,n,E),s.elementType=A,s.lanes=T,s;case C:return s=Si(19,a,n,E),s.elementType=C,s.lanes=T,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case _:$=10;break e;case p:$=9;break e;case k:$=11;break e;case N:$=14;break e;case j:$=16,u=null;break e}$=29,a=Error(r(130,s===null?"null":typeof s,"")),u=null}return n=Si($,a,n,E),n.elementType=s,n.type=u,n.lanes=T,n}function Nr(s,n,a,u){return s=Si(7,s,u,n),s.lanes=a,s}function Jh(s,n,a){return s=Si(6,s,null,n),s.lanes=a,s}function i_(s){var n=Si(18,null,null,0);return n.stateNode=s,n}function Zh(s,n,a){return n=Si(4,s.children!==null?s.children:[],s.key,n),n.lanes=a,n.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},n}var n_=new WeakMap;function Li(s,n){if(typeof s=="object"&&s!==null){var a=n_.get(s);return a!==void 0?a:(n={value:s,source:n,stack:at(n)},n_.set(s,n),n)}return{value:s,source:n,stack:at(n)}}var xa=[],Ca=0,wc=null,Ho=0,Ii=[],Pi=0,Zn=null,rn=1,an="";function bn(s,n){xa[Ca++]=Ho,xa[Ca++]=wc,wc=s,Ho=n}function r_(s,n,a){Ii[Pi++]=rn,Ii[Pi++]=an,Ii[Pi++]=Zn,Zn=s;var u=rn;s=an;var E=32-fs(u)-1;u&=~(1<<E),a+=1;var T=32-fs(n)+E;if(30<T){var $=E-E%5;T=(u&(1<<$)-1).toString(32),u>>=$,E-=$,rn=1<<32-fs(n)+E|a<<E|u,an=T+s}else rn=1<<T|a<<E|u,an=s}function Qh(s){s.return!==null&&(bn(s,1),r_(s,1,0))}function ef(s){for(;s===wc;)wc=xa[--Ca],xa[Ca]=null,Ho=xa[--Ca],xa[Ca]=null;for(;s===Zn;)Zn=Ii[--Pi],Ii[Pi]=null,an=Ii[--Pi],Ii[Pi]=null,rn=Ii[--Pi],Ii[Pi]=null}function a_(s,n){Ii[Pi++]=rn,Ii[Pi++]=an,Ii[Pi++]=Zn,rn=n.id,an=n.overflow,Zn=s}var Bs=null,ss=null,kt=!1,Qn=null,Bi=!1,tf=Error(r(519));function er(s){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw zo(Li(n,s)),tf}function o_(s){var n=s.stateNode,a=s.type,u=s.memoizedProps;switch(n[fe]=s,n[ye]=u,a){case"dialog":_t("cancel",n),_t("close",n);break;case"iframe":case"object":case"embed":_t("load",n);break;case"video":case"audio":for(a=0;a<cl.length;a++)_t(cl[a],n);break;case"source":_t("error",n);break;case"img":case"image":case"link":_t("error",n),_t("load",n);break;case"details":_t("toggle",n);break;case"input":_t("invalid",n),cc(n,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":_t("invalid",n);break;case"textarea":_t("invalid",n),jo(n,u.value,u.defaultValue,u.children)}a=u.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||u.suppressHydrationWarning===!0||Cy(n.textContent,a)?(u.popover!=null&&(_t("beforetoggle",n),_t("toggle",n)),u.onScroll!=null&&_t("scroll",n),u.onScrollEnd!=null&&_t("scrollend",n),u.onClick!=null&&(n.onclick=Oi),n=!0):n=!1,n||er(s,!0)}function l_(s){for(Bs=s.return;Bs;)switch(Bs.tag){case 5:case 31:case 13:Bi=!1;return;case 27:case 3:Bi=!0;return;default:Bs=Bs.return}}function Ea(s){if(s!==Bs)return!1;if(!kt)return l_(s),kt=!0,!1;var n=s.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=s.type,a=!(a!=="form"&&a!=="button")||bp(s.type,s.memoizedProps)),a=!a),a&&ss&&er(s),l_(s),n===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));ss=Dy(s)}else if(n===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));ss=Dy(s)}else n===27?(n=ss,pr(s.type)?(s=Ep,Ep=null,ss=s):ss=n):ss=Bs?zi(s.stateNode.nextSibling):null;return!0}function Mr(){ss=Bs=null,kt=!1}function sf(){var s=Qn;return s!==null&&(fi===null?fi=s:fi.push.apply(fi,s),Qn=null),s}function zo(s){Qn===null?Qn=[s]:Qn.push(s)}var nf=D(null),Dr=null,Sn=null;function tr(s,n,a){U(nf,n._currentValue),n._currentValue=a}function wn(s){s._currentValue=nf.current,H(nf)}function rf(s,n,a){for(;s!==null;){var u=s.alternate;if((s.childLanes&n)!==n?(s.childLanes|=n,u!==null&&(u.childLanes|=n)):u!==null&&(u.childLanes&n)!==n&&(u.childLanes|=n),s===a)break;s=s.return}}function af(s,n,a,u){var E=s.child;for(E!==null&&(E.return=s);E!==null;){var T=E.dependencies;if(T!==null){var $=E.child;T=T.firstContext;e:for(;T!==null;){var K=T;T=E;for(var ne=0;ne<n.length;ne++)if(K.context===n[ne]){T.lanes|=a,K=T.alternate,K!==null&&(K.lanes|=a),rf(T.return,a,s),u||($=null);break e}T=K.next}}else if(E.tag===18){if($=E.return,$===null)throw Error(r(341));$.lanes|=a,T=$.alternate,T!==null&&(T.lanes|=a),rf($,a,s),$=null}else $=E.child;if($!==null)$.return=E;else for($=E;$!==null;){if($===s){$=null;break}if(E=$.sibling,E!==null){E.return=$.return,$=E;break}$=$.return}E=$}}function ka(s,n,a,u){s=null;for(var E=n,T=!1;E!==null;){if(!T){if((E.flags&524288)!==0)T=!0;else if((E.flags&262144)!==0)break}if(E.tag===10){var $=E.alternate;if($===null)throw Error(r(387));if($=$.memoizedProps,$!==null){var K=E.type;bi(E.pendingProps.value,$.value)||(s!==null?s.push(K):s=[K])}}else if(E===Y.current){if($=E.alternate,$===null)throw Error(r(387));$.memoizedState.memoizedState!==E.memoizedState.memoizedState&&(s!==null?s.push(pl):s=[pl])}E=E.return}s!==null&&af(n,s,a,u),n.flags|=262144}function xc(s){for(s=s.firstContext;s!==null;){if(!bi(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Or(s){Dr=s,Sn=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Hs(s){return c_(Dr,s)}function Cc(s,n){return Dr===null&&Or(s),c_(s,n)}function c_(s,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Sn===null){if(s===null)throw Error(r(308));Sn=n,s.dependencies={lanes:0,firstContext:n},s.flags|=524288}else Sn=Sn.next=n;return a}var AE=typeof AbortController<"u"?AbortController:function(){var s=[],n=this.signal={aborted:!1,addEventListener:function(a,u){s.push(u)}};this.abort=function(){n.aborted=!0,s.forEach(function(a){return a()})}},jE=e.unstable_scheduleCallback,RE=e.unstable_NormalPriority,ks={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function of(){return{controller:new AE,data:new Map,refCount:0}}function Uo(s){s.refCount--,s.refCount===0&&jE(RE,function(){s.controller.abort()})}var qo=null,lf=0,Aa=0,ja=null;function TE(s,n){if(qo===null){var a=qo=[];lf=0,Aa=dp(),ja={status:"pending",value:void 0,then:function(u){a.push(u)}}}return lf++,n.then(u_,u_),n}function u_(){if(--lf===0&&qo!==null){ja!==null&&(ja.status="fulfilled");var s=qo;qo=null,Aa=0,ja=null;for(var n=0;n<s.length;n++)(0,s[n])()}}function NE(s,n){var a=[],u={status:"pending",value:null,reason:null,then:function(E){a.push(E)}};return s.then(function(){u.status="fulfilled",u.value=n;for(var E=0;E<a.length;E++)(0,a[E])(n)},function(E){for(u.status="rejected",u.reason=E,E=0;E<a.length;E++)(0,a[E])(void 0)}),u}var d_=W.S;W.S=function(s,n){K0=Je(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&TE(s,n),d_!==null&&d_(s,n)};var $r=D(null);function cf(){var s=$r.current;return s!==null?s:Xt.pooledCache}function Ec(s,n){n===null?U($r,$r.current):U($r,n.pool)}function h_(){var s=cf();return s===null?null:{parent:ks._currentValue,pool:s}}var Ra=Error(r(460)),uf=Error(r(474)),kc=Error(r(542)),Ac={then:function(){}};function f_(s){return s=s.status,s==="fulfilled"||s==="rejected"}function p_(s,n,a){switch(a=s[a],a===void 0?s.push(n):a!==n&&(n.then(Oi,Oi),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw s=n.reason,v_(s),s;default:if(typeof n.status=="string")n.then(Oi,Oi);else{if(s=Xt,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=n,s.status="pending",s.then(function(u){if(n.status==="pending"){var E=n;E.status="fulfilled",E.value=u}},function(u){if(n.status==="pending"){var E=n;E.status="rejected",E.reason=u}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw s=n.reason,v_(s),s}throw Ir=n,Ra}}function Lr(s){try{var n=s._init;return n(s._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Ir=a,Ra):a}}var Ir=null;function m_(){if(Ir===null)throw Error(r(459));var s=Ir;return Ir=null,s}function v_(s){if(s===Ra||s===kc)throw Error(r(483))}var Ta=null,Fo=0;function jc(s){var n=Fo;return Fo+=1,Ta===null&&(Ta=[]),p_(Ta,s,n)}function Vo(s,n){n=n.props.ref,s.ref=n!==void 0?n:null}function Rc(s,n){throw n.$$typeof===S?Error(r(525)):(s=Object.prototype.toString.call(n),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":s)))}function g_(s){function n(ce,re){if(s){var he=ce.deletions;he===null?(ce.deletions=[re],ce.flags|=16):he.push(re)}}function a(ce,re){if(!s)return null;for(;re!==null;)n(ce,re),re=re.sibling;return null}function u(ce){for(var re=new Map;ce!==null;)ce.key!==null?re.set(ce.key,ce):re.set(ce.index,ce),ce=ce.sibling;return re}function E(ce,re){return ce=yn(ce,re),ce.index=0,ce.sibling=null,ce}function T(ce,re,he){return ce.index=he,s?(he=ce.alternate,he!==null?(he=he.index,he<re?(ce.flags|=67108866,re):he):(ce.flags|=67108866,re)):(ce.flags|=1048576,re)}function $(ce){return s&&ce.alternate===null&&(ce.flags|=67108866),ce}function K(ce,re,he,Ce){return re===null||re.tag!==6?(re=Jh(he,ce.mode,Ce),re.return=ce,re):(re=E(re,he),re.return=ce,re)}function ne(ce,re,he,Ce){var Xe=he.type;return Xe===x?we(ce,re,he.props.children,Ce,he.key):re!==null&&(re.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===j&&Lr(Xe)===re.type)?(re=E(re,he.props),Vo(re,he),re.return=ce,re):(re=Sc(he.type,he.key,he.props,null,ce.mode,Ce),Vo(re,he),re.return=ce,re)}function pe(ce,re,he,Ce){return re===null||re.tag!==4||re.stateNode.containerInfo!==he.containerInfo||re.stateNode.implementation!==he.implementation?(re=Zh(he,ce.mode,Ce),re.return=ce,re):(re=E(re,he.children||[]),re.return=ce,re)}function we(ce,re,he,Ce,Xe){return re===null||re.tag!==7?(re=Nr(he,ce.mode,Ce,Xe),re.return=ce,re):(re=E(re,he),re.return=ce,re)}function ke(ce,re,he){if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return re=Jh(""+re,ce.mode,he),re.return=ce,re;if(typeof re=="object"&&re!==null){switch(re.$$typeof){case w:return he=Sc(re.type,re.key,re.props,null,ce.mode,he),Vo(he,re),he.return=ce,he;case R:return re=Zh(re,ce.mode,he),re.return=ce,re;case j:return re=Lr(re),ke(ce,re,he)}if(ee(re)||q(re))return re=Nr(re,ce.mode,he,null),re.return=ce,re;if(typeof re.then=="function")return ke(ce,jc(re),he);if(re.$$typeof===_)return ke(ce,Cc(ce,re),he);Rc(ce,re)}return null}function ge(ce,re,he,Ce){var Xe=re!==null?re.key:null;if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return Xe!==null?null:K(ce,re,""+he,Ce);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case w:return he.key===Xe?ne(ce,re,he,Ce):null;case R:return he.key===Xe?pe(ce,re,he,Ce):null;case j:return he=Lr(he),ge(ce,re,he,Ce)}if(ee(he)||q(he))return Xe!==null?null:we(ce,re,he,Ce,null);if(typeof he.then=="function")return ge(ce,re,jc(he),Ce);if(he.$$typeof===_)return ge(ce,re,Cc(ce,he),Ce);Rc(ce,he)}return null}function be(ce,re,he,Ce,Xe){if(typeof Ce=="string"&&Ce!==""||typeof Ce=="number"||typeof Ce=="bigint")return ce=ce.get(he)||null,K(re,ce,""+Ce,Xe);if(typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case w:return ce=ce.get(Ce.key===null?he:Ce.key)||null,ne(re,ce,Ce,Xe);case R:return ce=ce.get(Ce.key===null?he:Ce.key)||null,pe(re,ce,Ce,Xe);case j:return Ce=Lr(Ce),be(ce,re,he,Ce,Xe)}if(ee(Ce)||q(Ce))return ce=ce.get(he)||null,we(re,ce,Ce,Xe,null);if(typeof Ce.then=="function")return be(ce,re,he,jc(Ce),Xe);if(Ce.$$typeof===_)return be(ce,re,he,Cc(re,Ce),Xe);Rc(re,Ce)}return null}function Ue(ce,re,he,Ce){for(var Xe=null,Tt=null,Ve=re,ht=re=0,St=null;Ve!==null&&ht<he.length;ht++){Ve.index>ht?(St=Ve,Ve=null):St=Ve.sibling;var Nt=ge(ce,Ve,he[ht],Ce);if(Nt===null){Ve===null&&(Ve=St);break}s&&Ve&&Nt.alternate===null&&n(ce,Ve),re=T(Nt,re,ht),Tt===null?Xe=Nt:Tt.sibling=Nt,Tt=Nt,Ve=St}if(ht===he.length)return a(ce,Ve),kt&&bn(ce,ht),Xe;if(Ve===null){for(;ht<he.length;ht++)Ve=ke(ce,he[ht],Ce),Ve!==null&&(re=T(Ve,re,ht),Tt===null?Xe=Ve:Tt.sibling=Ve,Tt=Ve);return kt&&bn(ce,ht),Xe}for(Ve=u(Ve);ht<he.length;ht++)St=be(Ve,ce,ht,he[ht],Ce),St!==null&&(s&&St.alternate!==null&&Ve.delete(St.key===null?ht:St.key),re=T(St,re,ht),Tt===null?Xe=St:Tt.sibling=St,Tt=St);return s&&Ve.forEach(function(yr){return n(ce,yr)}),kt&&bn(ce,ht),Xe}function tt(ce,re,he,Ce){if(he==null)throw Error(r(151));for(var Xe=null,Tt=null,Ve=re,ht=re=0,St=null,Nt=he.next();Ve!==null&&!Nt.done;ht++,Nt=he.next()){Ve.index>ht?(St=Ve,Ve=null):St=Ve.sibling;var yr=ge(ce,Ve,Nt.value,Ce);if(yr===null){Ve===null&&(Ve=St);break}s&&Ve&&yr.alternate===null&&n(ce,Ve),re=T(yr,re,ht),Tt===null?Xe=yr:Tt.sibling=yr,Tt=yr,Ve=St}if(Nt.done)return a(ce,Ve),kt&&bn(ce,ht),Xe;if(Ve===null){for(;!Nt.done;ht++,Nt=he.next())Nt=ke(ce,Nt.value,Ce),Nt!==null&&(re=T(Nt,re,ht),Tt===null?Xe=Nt:Tt.sibling=Nt,Tt=Nt);return kt&&bn(ce,ht),Xe}for(Ve=u(Ve);!Nt.done;ht++,Nt=he.next())Nt=be(Ve,ce,ht,Nt.value,Ce),Nt!==null&&(s&&Nt.alternate!==null&&Ve.delete(Nt.key===null?ht:Nt.key),re=T(Nt,re,ht),Tt===null?Xe=Nt:Tt.sibling=Nt,Tt=Nt);return s&&Ve.forEach(function(Uk){return n(ce,Uk)}),kt&&bn(ce,ht),Xe}function Gt(ce,re,he,Ce){if(typeof he=="object"&&he!==null&&he.type===x&&he.key===null&&(he=he.props.children),typeof he=="object"&&he!==null){switch(he.$$typeof){case w:e:{for(var Xe=he.key;re!==null;){if(re.key===Xe){if(Xe=he.type,Xe===x){if(re.tag===7){a(ce,re.sibling),Ce=E(re,he.props.children),Ce.return=ce,ce=Ce;break e}}else if(re.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===j&&Lr(Xe)===re.type){a(ce,re.sibling),Ce=E(re,he.props),Vo(Ce,he),Ce.return=ce,ce=Ce;break e}a(ce,re);break}else n(ce,re);re=re.sibling}he.type===x?(Ce=Nr(he.props.children,ce.mode,Ce,he.key),Ce.return=ce,ce=Ce):(Ce=Sc(he.type,he.key,he.props,null,ce.mode,Ce),Vo(Ce,he),Ce.return=ce,ce=Ce)}return $(ce);case R:e:{for(Xe=he.key;re!==null;){if(re.key===Xe)if(re.tag===4&&re.stateNode.containerInfo===he.containerInfo&&re.stateNode.implementation===he.implementation){a(ce,re.sibling),Ce=E(re,he.children||[]),Ce.return=ce,ce=Ce;break e}else{a(ce,re);break}else n(ce,re);re=re.sibling}Ce=Zh(he,ce.mode,Ce),Ce.return=ce,ce=Ce}return $(ce);case j:return he=Lr(he),Gt(ce,re,he,Ce)}if(ee(he))return Ue(ce,re,he,Ce);if(q(he)){if(Xe=q(he),typeof Xe!="function")throw Error(r(150));return he=Xe.call(he),tt(ce,re,he,Ce)}if(typeof he.then=="function")return Gt(ce,re,jc(he),Ce);if(he.$$typeof===_)return Gt(ce,re,Cc(ce,he),Ce);Rc(ce,he)}return typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint"?(he=""+he,re!==null&&re.tag===6?(a(ce,re.sibling),Ce=E(re,he),Ce.return=ce,ce=Ce):(a(ce,re),Ce=Jh(he,ce.mode,Ce),Ce.return=ce,ce=Ce),$(ce)):a(ce,re)}return function(ce,re,he,Ce){try{Fo=0;var Xe=Gt(ce,re,he,Ce);return Ta=null,Xe}catch(Ve){if(Ve===Ra||Ve===kc)throw Ve;var Tt=Si(29,Ve,null,ce.mode);return Tt.lanes=Ce,Tt.return=ce,Tt}finally{}}}var Pr=g_(!0),__=g_(!1),sr=!1;function df(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hf(s,n){s=s.updateQueue,n.updateQueue===s&&(n.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function ir(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function nr(s,n,a){var u=s.updateQueue;if(u===null)return null;if(u=u.shared,(Ot&2)!==0){var E=u.pending;return E===null?n.next=n:(n.next=E.next,E.next=n),u.pending=n,n=bc(s),t_(s,null,a),n}return yc(s,u,n,a),bc(s)}function Wo(s,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var u=n.lanes;u&=s.pendingLanes,a|=u,n.lanes=a,Ms(s,a)}}function ff(s,n){var a=s.updateQueue,u=s.alternate;if(u!==null&&(u=u.updateQueue,a===u)){var E=null,T=null;if(a=a.firstBaseUpdate,a!==null){do{var $={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};T===null?E=T=$:T=T.next=$,a=a.next}while(a!==null);T===null?E=T=n:T=T.next=n}else E=T=n;a={baseState:u.baseState,firstBaseUpdate:E,lastBaseUpdate:T,shared:u.shared,callbacks:u.callbacks},s.updateQueue=a;return}s=a.lastBaseUpdate,s===null?a.firstBaseUpdate=n:s.next=n,a.lastBaseUpdate=n}var pf=!1;function Go(){if(pf){var s=ja;if(s!==null)throw s}}function Ko(s,n,a,u){pf=!1;var E=s.updateQueue;sr=!1;var T=E.firstBaseUpdate,$=E.lastBaseUpdate,K=E.shared.pending;if(K!==null){E.shared.pending=null;var ne=K,pe=ne.next;ne.next=null,$===null?T=pe:$.next=pe,$=ne;var we=s.alternate;we!==null&&(we=we.updateQueue,K=we.lastBaseUpdate,K!==$&&(K===null?we.firstBaseUpdate=pe:K.next=pe,we.lastBaseUpdate=ne))}if(T!==null){var ke=E.baseState;$=0,we=pe=ne=null,K=T;do{var ge=K.lane&-536870913,be=ge!==K.lane;if(be?(bt&ge)===ge:(u&ge)===ge){ge!==0&&ge===Aa&&(pf=!0),we!==null&&(we=we.next={lane:0,tag:K.tag,payload:K.payload,callback:null,next:null});e:{var Ue=s,tt=K;ge=n;var Gt=a;switch(tt.tag){case 1:if(Ue=tt.payload,typeof Ue=="function"){ke=Ue.call(Gt,ke,ge);break e}ke=Ue;break e;case 3:Ue.flags=Ue.flags&-65537|128;case 0:if(Ue=tt.payload,ge=typeof Ue=="function"?Ue.call(Gt,ke,ge):Ue,ge==null)break e;ke=v({},ke,ge);break e;case 2:sr=!0}}ge=K.callback,ge!==null&&(s.flags|=64,be&&(s.flags|=8192),be=E.callbacks,be===null?E.callbacks=[ge]:be.push(ge))}else be={lane:ge,tag:K.tag,payload:K.payload,callback:K.callback,next:null},we===null?(pe=we=be,ne=ke):we=we.next=be,$|=ge;if(K=K.next,K===null){if(K=E.shared.pending,K===null)break;be=K,K=be.next,be.next=null,E.lastBaseUpdate=be,E.shared.pending=null}}while(!0);we===null&&(ne=ke),E.baseState=ne,E.firstBaseUpdate=pe,E.lastBaseUpdate=we,T===null&&(E.shared.lanes=0),cr|=$,s.lanes=$,s.memoizedState=ke}}function y_(s,n){if(typeof s!="function")throw Error(r(191,s));s.call(n)}function b_(s,n){var a=s.callbacks;if(a!==null)for(s.callbacks=null,s=0;s<a.length;s++)y_(a[s],n)}var Na=D(null),Tc=D(0);function S_(s,n){s=Nn,U(Tc,s),U(Na,n),Nn=s|n.baseLanes}function mf(){U(Tc,Nn),U(Na,Na.current)}function vf(){Nn=Tc.current,H(Na),H(Tc)}var wi=D(null),Hi=null;function rr(s){var n=s.alternate;U(bs,bs.current&1),U(wi,s),Hi===null&&(n===null||Na.current!==null||n.memoizedState!==null)&&(Hi=s)}function gf(s){U(bs,bs.current),U(wi,s),Hi===null&&(Hi=s)}function w_(s){s.tag===22?(U(bs,bs.current),U(wi,s),Hi===null&&(Hi=s)):ar()}function ar(){U(bs,bs.current),U(wi,wi.current)}function xi(s){H(wi),Hi===s&&(Hi=null),H(bs)}var bs=D(0);function Nc(s){for(var n=s;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||xp(a)||Cp(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===s)break;for(;n.sibling===null;){if(n.return===null||n.return===s)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var xn=0,ut=null,Vt=null,As=null,Mc=!1,Ma=!1,Br=!1,Dc=0,Yo=0,Da=null,ME=0;function vs(){throw Error(r(321))}function _f(s,n){if(n===null)return!1;for(var a=0;a<n.length&&a<s.length;a++)if(!bi(s[a],n[a]))return!1;return!0}function yf(s,n,a,u,E,T){return xn=T,ut=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,W.H=s===null||s.memoizedState===null?r0:Of,Br=!1,T=a(u,E),Br=!1,Ma&&(T=C_(n,a,u,E)),x_(s),T}function x_(s){W.H=Zo;var n=Vt!==null&&Vt.next!==null;if(xn=0,As=Vt=ut=null,Mc=!1,Yo=0,Da=null,n)throw Error(r(300));s===null||js||(s=s.dependencies,s!==null&&xc(s)&&(js=!0))}function C_(s,n,a,u){ut=s;var E=0;do{if(Ma&&(Da=null),Yo=0,Ma=!1,25<=E)throw Error(r(301));if(E+=1,As=Vt=null,s.updateQueue!=null){var T=s.updateQueue;T.lastEffect=null,T.events=null,T.stores=null,T.memoCache!=null&&(T.memoCache.index=0)}W.H=a0,T=n(a,u)}while(Ma);return T}function DE(){var s=W.H,n=s.useState()[0];return n=typeof n.then=="function"?Xo(n):n,s=s.useState()[0],(Vt!==null?Vt.memoizedState:null)!==s&&(ut.flags|=1024),n}function bf(){var s=Dc!==0;return Dc=0,s}function Sf(s,n,a){n.updateQueue=s.updateQueue,n.flags&=-2053,s.lanes&=~a}function wf(s){if(Mc){for(s=s.memoizedState;s!==null;){var n=s.queue;n!==null&&(n.pending=null),s=s.next}Mc=!1}xn=0,As=Vt=ut=null,Ma=!1,Yo=Dc=0,Da=null}function ii(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return As===null?ut.memoizedState=As=s:As=As.next=s,As}function Ss(){if(Vt===null){var s=ut.alternate;s=s!==null?s.memoizedState:null}else s=Vt.next;var n=As===null?ut.memoizedState:As.next;if(n!==null)As=n,Vt=s;else{if(s===null)throw ut.alternate===null?Error(r(467)):Error(r(310));Vt=s,s={memoizedState:Vt.memoizedState,baseState:Vt.baseState,baseQueue:Vt.baseQueue,queue:Vt.queue,next:null},As===null?ut.memoizedState=As=s:As=As.next=s}return As}function Oc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Xo(s){var n=Yo;return Yo+=1,Da===null&&(Da=[]),s=p_(Da,s,n),n=ut,(As===null?n.memoizedState:As.next)===null&&(n=n.alternate,W.H=n===null||n.memoizedState===null?r0:Of),s}function $c(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Xo(s);if(s.$$typeof===_)return Hs(s)}throw Error(r(438,String(s)))}function xf(s){var n=null,a=ut.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var u=ut.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(n={data:u.data.map(function(E){return E.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Oc(),ut.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(s),u=0;u<s;u++)a[u]=O;return n.index++,a}function Cn(s,n){return typeof n=="function"?n(s):n}function Lc(s){var n=Ss();return Cf(n,Vt,s)}function Cf(s,n,a){var u=s.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=a;var E=s.baseQueue,T=u.pending;if(T!==null){if(E!==null){var $=E.next;E.next=T.next,T.next=$}n.baseQueue=E=T,u.pending=null}if(T=s.baseState,E===null)s.memoizedState=T;else{n=E.next;var K=$=null,ne=null,pe=n,we=!1;do{var ke=pe.lane&-536870913;if(ke!==pe.lane?(bt&ke)===ke:(xn&ke)===ke){var ge=pe.revertLane;if(ge===0)ne!==null&&(ne=ne.next={lane:0,revertLane:0,gesture:null,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null}),ke===Aa&&(we=!0);else if((xn&ge)===ge){pe=pe.next,ge===Aa&&(we=!0);continue}else ke={lane:0,revertLane:pe.revertLane,gesture:null,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null},ne===null?(K=ne=ke,$=T):ne=ne.next=ke,ut.lanes|=ge,cr|=ge;ke=pe.action,Br&&a(T,ke),T=pe.hasEagerState?pe.eagerState:a(T,ke)}else ge={lane:ke,revertLane:pe.revertLane,gesture:pe.gesture,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null},ne===null?(K=ne=ge,$=T):ne=ne.next=ge,ut.lanes|=ke,cr|=ke;pe=pe.next}while(pe!==null&&pe!==n);if(ne===null?$=T:ne.next=K,!bi(T,s.memoizedState)&&(js=!0,we&&(a=ja,a!==null)))throw a;s.memoizedState=T,s.baseState=$,s.baseQueue=ne,u.lastRenderedState=T}return E===null&&(u.lanes=0),[s.memoizedState,u.dispatch]}function Ef(s){var n=Ss(),a=n.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=s;var u=a.dispatch,E=a.pending,T=n.memoizedState;if(E!==null){a.pending=null;var $=E=E.next;do T=s(T,$.action),$=$.next;while($!==E);bi(T,n.memoizedState)||(js=!0),n.memoizedState=T,n.baseQueue===null&&(n.baseState=T),a.lastRenderedState=T}return[T,u]}function E_(s,n,a){var u=ut,E=Ss(),T=kt;if(T){if(a===void 0)throw Error(r(407));a=a()}else a=n();var $=!bi((Vt||E).memoizedState,a);if($&&(E.memoizedState=a,js=!0),E=E.queue,jf(j_.bind(null,u,E,s),[s]),E.getSnapshot!==n||$||As!==null&&As.memoizedState.tag&1){if(u.flags|=2048,Oa(9,{destroy:void 0},A_.bind(null,u,E,a,n),null),Xt===null)throw Error(r(349));T||(xn&127)!==0||k_(u,n,a)}return a}function k_(s,n,a){s.flags|=16384,s={getSnapshot:n,value:a},n=ut.updateQueue,n===null?(n=Oc(),ut.updateQueue=n,n.stores=[s]):(a=n.stores,a===null?n.stores=[s]:a.push(s))}function A_(s,n,a,u){n.value=a,n.getSnapshot=u,R_(n)&&T_(s)}function j_(s,n,a){return a(function(){R_(n)&&T_(s)})}function R_(s){var n=s.getSnapshot;s=s.value;try{var a=n();return!bi(s,a)}catch{return!0}}function T_(s){var n=Tr(s,2);n!==null&&pi(n,s,2)}function kf(s){var n=ii();if(typeof s=="function"){var a=s;if(s=a(),Br){Ns(!0);try{a()}finally{Ns(!1)}}}return n.memoizedState=n.baseState=s,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cn,lastRenderedState:s},n}function N_(s,n,a,u){return s.baseState=a,Cf(s,Vt,typeof u=="function"?u:Cn)}function OE(s,n,a,u,E){if(Bc(s))throw Error(r(485));if(s=n.action,s!==null){var T={payload:E,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function($){T.listeners.push($)}};W.T!==null?a(!0):T.isTransition=!1,u(T),a=n.pending,a===null?(T.next=n.pending=T,M_(n,T)):(T.next=a.next,n.pending=a.next=T)}}function M_(s,n){var a=n.action,u=n.payload,E=s.state;if(n.isTransition){var T=W.T,$={};W.T=$;try{var K=a(E,u),ne=W.S;ne!==null&&ne($,K),D_(s,n,K)}catch(pe){Af(s,n,pe)}finally{T!==null&&$.types!==null&&(T.types=$.types),W.T=T}}else try{T=a(E,u),D_(s,n,T)}catch(pe){Af(s,n,pe)}}function D_(s,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(u){O_(s,n,u)},function(u){return Af(s,n,u)}):O_(s,n,a)}function O_(s,n,a){n.status="fulfilled",n.value=a,$_(n),s.state=a,n=s.pending,n!==null&&(a=n.next,a===n?s.pending=null:(a=a.next,n.next=a,M_(s,a)))}function Af(s,n,a){var u=s.pending;if(s.pending=null,u!==null){u=u.next;do n.status="rejected",n.reason=a,$_(n),n=n.next;while(n!==u)}s.action=null}function $_(s){s=s.listeners;for(var n=0;n<s.length;n++)(0,s[n])()}function L_(s,n){return n}function I_(s,n){if(kt){var a=Xt.formState;if(a!==null){e:{var u=ut;if(kt){if(ss){t:{for(var E=ss,T=Bi;E.nodeType!==8;){if(!T){E=null;break t}if(E=zi(E.nextSibling),E===null){E=null;break t}}T=E.data,E=T==="F!"||T==="F"?E:null}if(E){ss=zi(E.nextSibling),u=E.data==="F!";break e}}er(u)}u=!1}u&&(n=a[0])}}return a=ii(),a.memoizedState=a.baseState=n,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:L_,lastRenderedState:n},a.queue=u,a=s0.bind(null,ut,u),u.dispatch=a,u=kf(!1),T=Df.bind(null,ut,!1,u.queue),u=ii(),E={state:n,dispatch:null,action:s,pending:null},u.queue=E,a=OE.bind(null,ut,E,T,a),E.dispatch=a,u.memoizedState=s,[n,a,!1]}function P_(s){var n=Ss();return B_(n,Vt,s)}function B_(s,n,a){if(n=Cf(s,n,L_)[0],s=Lc(Cn)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var u=Xo(n)}catch($){throw $===Ra?kc:$}else u=n;n=Ss();var E=n.queue,T=E.dispatch;return a!==n.memoizedState&&(ut.flags|=2048,Oa(9,{destroy:void 0},$E.bind(null,E,a),null)),[u,T,s]}function $E(s,n){s.action=n}function H_(s){var n=Ss(),a=Vt;if(a!==null)return B_(n,a,s);Ss(),n=n.memoizedState,a=Ss();var u=a.queue.dispatch;return a.memoizedState=s,[n,u,!1]}function Oa(s,n,a,u){return s={tag:s,create:a,deps:u,inst:n,next:null},n=ut.updateQueue,n===null&&(n=Oc(),ut.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=s.next=s:(u=a.next,a.next=s,s.next=u,n.lastEffect=s),s}function z_(){return Ss().memoizedState}function Ic(s,n,a,u){var E=ii();ut.flags|=s,E.memoizedState=Oa(1|n,{destroy:void 0},a,u===void 0?null:u)}function Pc(s,n,a,u){var E=Ss();u=u===void 0?null:u;var T=E.memoizedState.inst;Vt!==null&&u!==null&&_f(u,Vt.memoizedState.deps)?E.memoizedState=Oa(n,T,a,u):(ut.flags|=s,E.memoizedState=Oa(1|n,T,a,u))}function U_(s,n){Ic(8390656,8,s,n)}function jf(s,n){Pc(2048,8,s,n)}function LE(s){ut.flags|=4;var n=ut.updateQueue;if(n===null)n=Oc(),ut.updateQueue=n,n.events=[s];else{var a=n.events;a===null?n.events=[s]:a.push(s)}}function q_(s){var n=Ss().memoizedState;return LE({ref:n,nextImpl:s}),function(){if((Ot&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function F_(s,n){return Pc(4,2,s,n)}function V_(s,n){return Pc(4,4,s,n)}function W_(s,n){if(typeof n=="function"){s=s();var a=n(s);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return s=s(),n.current=s,function(){n.current=null}}function G_(s,n,a){a=a!=null?a.concat([s]):null,Pc(4,4,W_.bind(null,n,s),a)}function Rf(){}function K_(s,n){var a=Ss();n=n===void 0?null:n;var u=a.memoizedState;return n!==null&&_f(n,u[1])?u[0]:(a.memoizedState=[s,n],s)}function Y_(s,n){var a=Ss();n=n===void 0?null:n;var u=a.memoizedState;if(n!==null&&_f(n,u[1]))return u[0];if(u=s(),Br){Ns(!0);try{s()}finally{Ns(!1)}}return a.memoizedState=[u,n],u}function Tf(s,n,a){return a===void 0||(xn&1073741824)!==0&&(bt&261930)===0?s.memoizedState=n:(s.memoizedState=a,s=X0(),ut.lanes|=s,cr|=s,a)}function X_(s,n,a,u){return bi(a,n)?a:Na.current!==null?(s=Tf(s,a,u),bi(s,n)||(js=!0),s):(xn&42)===0||(xn&1073741824)!==0&&(bt&261930)===0?(js=!0,s.memoizedState=a):(s=X0(),ut.lanes|=s,cr|=s,n)}function J_(s,n,a,u,E){var T=Q.p;Q.p=T!==0&&8>T?T:8;var $=W.T,K={};W.T=K,Df(s,!1,n,a);try{var ne=E(),pe=W.S;if(pe!==null&&pe(K,ne),ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var we=NE(ne,u);Jo(s,n,we,ki(s))}else Jo(s,n,u,ki(s))}catch(ke){Jo(s,n,{then:function(){},status:"rejected",reason:ke},ki())}finally{Q.p=T,$!==null&&K.types!==null&&($.types=K.types),W.T=$}}function IE(){}function Nf(s,n,a,u){if(s.tag!==5)throw Error(r(476));var E=Z_(s).queue;J_(s,E,n,ie,a===null?IE:function(){return Q_(s),a(u)})}function Z_(s){var n=s.memoizedState;if(n!==null)return n;n={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cn,lastRenderedState:ie},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cn,lastRenderedState:a},next:null},s.memoizedState=n,s=s.alternate,s!==null&&(s.memoizedState=n),n}function Q_(s){var n=Z_(s);n.next===null&&(n=s.alternate.memoizedState),Jo(s,n.next.queue,{},ki())}function Mf(){return Hs(pl)}function e0(){return Ss().memoizedState}function t0(){return Ss().memoizedState}function PE(s){for(var n=s.return;n!==null;){switch(n.tag){case 24:case 3:var a=ki();s=ir(a);var u=nr(n,s,a);u!==null&&(pi(u,n,a),Wo(u,n,a)),n={cache:of()},s.payload=n;return}n=n.return}}function BE(s,n,a){var u=ki();a={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Bc(s)?i0(n,a):(a=Yh(s,n,a,u),a!==null&&(pi(a,s,u),n0(a,n,u)))}function s0(s,n,a){var u=ki();Jo(s,n,a,u)}function Jo(s,n,a,u){var E={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Bc(s))i0(n,E);else{var T=s.alternate;if(s.lanes===0&&(T===null||T.lanes===0)&&(T=n.lastRenderedReducer,T!==null))try{var $=n.lastRenderedState,K=T($,a);if(E.hasEagerState=!0,E.eagerState=K,bi(K,$))return yc(s,n,E,0),Xt===null&&_c(),!1}catch{}finally{}if(a=Yh(s,n,E,u),a!==null)return pi(a,s,u),n0(a,n,u),!0}return!1}function Df(s,n,a,u){if(u={lane:2,revertLane:dp(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Bc(s)){if(n)throw Error(r(479))}else n=Yh(s,a,u,2),n!==null&&pi(n,s,2)}function Bc(s){var n=s.alternate;return s===ut||n!==null&&n===ut}function i0(s,n){Ma=Mc=!0;var a=s.pending;a===null?n.next=n:(n.next=a.next,a.next=n),s.pending=n}function n0(s,n,a){if((a&4194048)!==0){var u=n.lanes;u&=s.pendingLanes,a|=u,n.lanes=a,Ms(s,a)}}var Zo={readContext:Hs,use:$c,useCallback:vs,useContext:vs,useEffect:vs,useImperativeHandle:vs,useLayoutEffect:vs,useInsertionEffect:vs,useMemo:vs,useReducer:vs,useRef:vs,useState:vs,useDebugValue:vs,useDeferredValue:vs,useTransition:vs,useSyncExternalStore:vs,useId:vs,useHostTransitionStatus:vs,useFormState:vs,useActionState:vs,useOptimistic:vs,useMemoCache:vs,useCacheRefresh:vs};Zo.useEffectEvent=vs;var r0={readContext:Hs,use:$c,useCallback:function(s,n){return ii().memoizedState=[s,n===void 0?null:n],s},useContext:Hs,useEffect:U_,useImperativeHandle:function(s,n,a){a=a!=null?a.concat([s]):null,Ic(4194308,4,W_.bind(null,n,s),a)},useLayoutEffect:function(s,n){return Ic(4194308,4,s,n)},useInsertionEffect:function(s,n){Ic(4,2,s,n)},useMemo:function(s,n){var a=ii();n=n===void 0?null:n;var u=s();if(Br){Ns(!0);try{s()}finally{Ns(!1)}}return a.memoizedState=[u,n],u},useReducer:function(s,n,a){var u=ii();if(a!==void 0){var E=a(n);if(Br){Ns(!0);try{a(n)}finally{Ns(!1)}}}else E=n;return u.memoizedState=u.baseState=E,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:E},u.queue=s,s=s.dispatch=BE.bind(null,ut,s),[u.memoizedState,s]},useRef:function(s){var n=ii();return s={current:s},n.memoizedState=s},useState:function(s){s=kf(s);var n=s.queue,a=s0.bind(null,ut,n);return n.dispatch=a,[s.memoizedState,a]},useDebugValue:Rf,useDeferredValue:function(s,n){var a=ii();return Tf(a,s,n)},useTransition:function(){var s=kf(!1);return s=J_.bind(null,ut,s.queue,!0,!1),ii().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,n,a){var u=ut,E=ii();if(kt){if(a===void 0)throw Error(r(407));a=a()}else{if(a=n(),Xt===null)throw Error(r(349));(bt&127)!==0||k_(u,n,a)}E.memoizedState=a;var T={value:a,getSnapshot:n};return E.queue=T,U_(j_.bind(null,u,T,s),[s]),u.flags|=2048,Oa(9,{destroy:void 0},A_.bind(null,u,T,a,n),null),a},useId:function(){var s=ii(),n=Xt.identifierPrefix;if(kt){var a=an,u=rn;a=(u&~(1<<32-fs(u)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Dc++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=ME++,n="_"+n+"r_"+a.toString(32)+"_";return s.memoizedState=n},useHostTransitionStatus:Mf,useFormState:I_,useActionState:I_,useOptimistic:function(s){var n=ii();n.memoizedState=n.baseState=s;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Df.bind(null,ut,!0,a),a.dispatch=n,[s,n]},useMemoCache:xf,useCacheRefresh:function(){return ii().memoizedState=PE.bind(null,ut)},useEffectEvent:function(s){var n=ii(),a={impl:s};return n.memoizedState=a,function(){if((Ot&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Of={readContext:Hs,use:$c,useCallback:K_,useContext:Hs,useEffect:jf,useImperativeHandle:G_,useInsertionEffect:F_,useLayoutEffect:V_,useMemo:Y_,useReducer:Lc,useRef:z_,useState:function(){return Lc(Cn)},useDebugValue:Rf,useDeferredValue:function(s,n){var a=Ss();return X_(a,Vt.memoizedState,s,n)},useTransition:function(){var s=Lc(Cn)[0],n=Ss().memoizedState;return[typeof s=="boolean"?s:Xo(s),n]},useSyncExternalStore:E_,useId:e0,useHostTransitionStatus:Mf,useFormState:P_,useActionState:P_,useOptimistic:function(s,n){var a=Ss();return N_(a,Vt,s,n)},useMemoCache:xf,useCacheRefresh:t0};Of.useEffectEvent=q_;var a0={readContext:Hs,use:$c,useCallback:K_,useContext:Hs,useEffect:jf,useImperativeHandle:G_,useInsertionEffect:F_,useLayoutEffect:V_,useMemo:Y_,useReducer:Ef,useRef:z_,useState:function(){return Ef(Cn)},useDebugValue:Rf,useDeferredValue:function(s,n){var a=Ss();return Vt===null?Tf(a,s,n):X_(a,Vt.memoizedState,s,n)},useTransition:function(){var s=Ef(Cn)[0],n=Ss().memoizedState;return[typeof s=="boolean"?s:Xo(s),n]},useSyncExternalStore:E_,useId:e0,useHostTransitionStatus:Mf,useFormState:H_,useActionState:H_,useOptimistic:function(s,n){var a=Ss();return Vt!==null?N_(a,Vt,s,n):(a.baseState=s,[s,a.queue.dispatch])},useMemoCache:xf,useCacheRefresh:t0};a0.useEffectEvent=q_;function $f(s,n,a,u){n=s.memoizedState,a=a(u,n),a=a==null?n:v({},n,a),s.memoizedState=a,s.lanes===0&&(s.updateQueue.baseState=a)}var Lf={enqueueSetState:function(s,n,a){s=s._reactInternals;var u=ki(),E=ir(u);E.payload=n,a!=null&&(E.callback=a),n=nr(s,E,u),n!==null&&(pi(n,s,u),Wo(n,s,u))},enqueueReplaceState:function(s,n,a){s=s._reactInternals;var u=ki(),E=ir(u);E.tag=1,E.payload=n,a!=null&&(E.callback=a),n=nr(s,E,u),n!==null&&(pi(n,s,u),Wo(n,s,u))},enqueueForceUpdate:function(s,n){s=s._reactInternals;var a=ki(),u=ir(a);u.tag=2,n!=null&&(u.callback=n),n=nr(s,u,a),n!==null&&(pi(n,s,a),Wo(n,s,a))}};function o0(s,n,a,u,E,T,$){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(u,T,$):n.prototype&&n.prototype.isPureReactComponent?!Po(a,u)||!Po(E,T):!0}function l0(s,n,a,u){s=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,u),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,u),n.state!==s&&Lf.enqueueReplaceState(n,n.state,null)}function Hr(s,n){var a=n;if("ref"in n){a={};for(var u in n)u!=="ref"&&(a[u]=n[u])}if(s=s.defaultProps){a===n&&(a=v({},a));for(var E in s)a[E]===void 0&&(a[E]=s[E])}return a}function c0(s){gc(s)}function u0(s){console.error(s)}function d0(s){gc(s)}function Hc(s,n){try{var a=s.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(u){setTimeout(function(){throw u})}}function h0(s,n,a){try{var u=s.onCaughtError;u(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(E){setTimeout(function(){throw E})}}function If(s,n,a){return a=ir(a),a.tag=3,a.payload={element:null},a.callback=function(){Hc(s,n)},a}function f0(s){return s=ir(s),s.tag=3,s}function p0(s,n,a,u){var E=a.type.getDerivedStateFromError;if(typeof E=="function"){var T=u.value;s.payload=function(){return E(T)},s.callback=function(){h0(n,a,u)}}var $=a.stateNode;$!==null&&typeof $.componentDidCatch=="function"&&(s.callback=function(){h0(n,a,u),typeof E!="function"&&(ur===null?ur=new Set([this]):ur.add(this));var K=u.stack;this.componentDidCatch(u.value,{componentStack:K!==null?K:""})})}function HE(s,n,a,u,E){if(a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(n=a.alternate,n!==null&&ka(n,a,E,!0),a=wi.current,a!==null){switch(a.tag){case 31:case 13:return Hi===null?Zc():a.alternate===null&&gs===0&&(gs=3),a.flags&=-257,a.flags|=65536,a.lanes=E,u===Ac?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([u]):n.add(u),lp(s,u,E)),!1;case 22:return a.flags|=65536,u===Ac?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([u])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([u]):a.add(u)),lp(s,u,E)),!1}throw Error(r(435,a.tag))}return lp(s,u,E),Zc(),!1}if(kt)return n=wi.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=E,u!==tf&&(s=Error(r(422),{cause:u}),zo(Li(s,a)))):(u!==tf&&(n=Error(r(423),{cause:u}),zo(Li(n,a))),s=s.current.alternate,s.flags|=65536,E&=-E,s.lanes|=E,u=Li(u,a),E=If(s.stateNode,u,E),ff(s,E),gs!==4&&(gs=2)),!1;var T=Error(r(520),{cause:u});if(T=Li(T,a),al===null?al=[T]:al.push(T),gs!==4&&(gs=2),n===null)return!0;u=Li(u,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,s=E&-E,a.lanes|=s,s=If(a.stateNode,u,s),ff(a,s),!1;case 1:if(n=a.type,T=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||T!==null&&typeof T.componentDidCatch=="function"&&(ur===null||!ur.has(T))))return a.flags|=65536,E&=-E,a.lanes|=E,E=f0(E),p0(E,s,a,u),ff(a,E),!1}a=a.return}while(a!==null);return!1}var Pf=Error(r(461)),js=!1;function zs(s,n,a,u){n.child=s===null?__(n,null,a,u):Pr(n,s.child,a,u)}function m0(s,n,a,u,E){a=a.render;var T=n.ref;if("ref"in u){var $={};for(var K in u)K!=="ref"&&($[K]=u[K])}else $=u;return Or(n),u=yf(s,n,a,$,T,E),K=bf(),s!==null&&!js?(Sf(s,n,E),En(s,n,E)):(kt&&K&&Qh(n),n.flags|=1,zs(s,n,u,E),n.child)}function v0(s,n,a,u,E){if(s===null){var T=a.type;return typeof T=="function"&&!Xh(T)&&T.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=T,g0(s,n,T,u,E)):(s=Sc(a.type,null,u,n,n.mode,E),s.ref=n.ref,s.return=n,n.child=s)}if(T=s.child,!Wf(s,E)){var $=T.memoizedProps;if(a=a.compare,a=a!==null?a:Po,a($,u)&&s.ref===n.ref)return En(s,n,E)}return n.flags|=1,s=yn(T,u),s.ref=n.ref,s.return=n,n.child=s}function g0(s,n,a,u,E){if(s!==null){var T=s.memoizedProps;if(Po(T,u)&&s.ref===n.ref)if(js=!1,n.pendingProps=u=T,Wf(s,E))(s.flags&131072)!==0&&(js=!0);else return n.lanes=s.lanes,En(s,n,E)}return Bf(s,n,a,u,E)}function _0(s,n,a,u){var E=u.children,T=s!==null?s.memoizedState:null;if(s===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((n.flags&128)!==0){if(T=T!==null?T.baseLanes|a:a,s!==null){for(u=n.child=s.child,E=0;u!==null;)E=E|u.lanes|u.childLanes,u=u.sibling;u=E&~T}else u=0,n.child=null;return y0(s,n,T,a,u)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},s!==null&&Ec(n,T!==null?T.cachePool:null),T!==null?S_(n,T):mf(),w_(n);else return u=n.lanes=536870912,y0(s,n,T!==null?T.baseLanes|a:a,a,u)}else T!==null?(Ec(n,T.cachePool),S_(n,T),ar(),n.memoizedState=null):(s!==null&&Ec(n,null),mf(),ar());return zs(s,n,E,a),n.child}function Qo(s,n){return s!==null&&s.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function y0(s,n,a,u,E){var T=cf();return T=T===null?null:{parent:ks._currentValue,pool:T},n.memoizedState={baseLanes:a,cachePool:T},s!==null&&Ec(n,null),mf(),w_(n),s!==null&&ka(s,n,u,!0),n.childLanes=E,null}function zc(s,n){return n=qc({mode:n.mode,children:n.children},s.mode),n.ref=s.ref,s.child=n,n.return=s,n}function b0(s,n,a){return Pr(n,s.child,null,a),s=zc(n,n.pendingProps),s.flags|=2,xi(n),n.memoizedState=null,s}function zE(s,n,a){var u=n.pendingProps,E=(n.flags&128)!==0;if(n.flags&=-129,s===null){if(kt){if(u.mode==="hidden")return s=zc(n,u),n.lanes=536870912,Qo(null,s);if(gf(n),(s=ss)?(s=My(s,Bi),s=s!==null&&s.data==="&"?s:null,s!==null&&(n.memoizedState={dehydrated:s,treeContext:Zn!==null?{id:rn,overflow:an}:null,retryLane:536870912,hydrationErrors:null},a=i_(s),a.return=n,n.child=a,Bs=n,ss=null)):s=null,s===null)throw er(n);return n.lanes=536870912,null}return zc(n,u)}var T=s.memoizedState;if(T!==null){var $=T.dehydrated;if(gf(n),E)if(n.flags&256)n.flags&=-257,n=b0(s,n,a);else if(n.memoizedState!==null)n.child=s.child,n.flags|=128,n=null;else throw Error(r(558));else if(js||ka(s,n,a,!1),E=(a&s.childLanes)!==0,js||E){if(u=Xt,u!==null&&($=Is(u,a),$!==0&&$!==T.retryLane))throw T.retryLane=$,Tr(s,$),pi(u,s,$),Pf;Zc(),n=b0(s,n,a)}else s=T.treeContext,ss=zi($.nextSibling),Bs=n,kt=!0,Qn=null,Bi=!1,s!==null&&a_(n,s),n=zc(n,u),n.flags|=4096;return n}return s=yn(s.child,{mode:u.mode,children:u.children}),s.ref=n.ref,n.child=s,s.return=n,s}function Uc(s,n){var a=n.ref;if(a===null)s!==null&&s.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(s===null||s.ref!==a)&&(n.flags|=4194816)}}function Bf(s,n,a,u,E){return Or(n),a=yf(s,n,a,u,void 0,E),u=bf(),s!==null&&!js?(Sf(s,n,E),En(s,n,E)):(kt&&u&&Qh(n),n.flags|=1,zs(s,n,a,E),n.child)}function S0(s,n,a,u,E,T){return Or(n),n.updateQueue=null,a=C_(n,u,a,E),x_(s),u=bf(),s!==null&&!js?(Sf(s,n,T),En(s,n,T)):(kt&&u&&Qh(n),n.flags|=1,zs(s,n,a,T),n.child)}function w0(s,n,a,u,E){if(Or(n),n.stateNode===null){var T=wa,$=a.contextType;typeof $=="object"&&$!==null&&(T=Hs($)),T=new a(u,T),n.memoizedState=T.state!==null&&T.state!==void 0?T.state:null,T.updater=Lf,n.stateNode=T,T._reactInternals=n,T=n.stateNode,T.props=u,T.state=n.memoizedState,T.refs={},df(n),$=a.contextType,T.context=typeof $=="object"&&$!==null?Hs($):wa,T.state=n.memoizedState,$=a.getDerivedStateFromProps,typeof $=="function"&&($f(n,a,$,u),T.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof T.getSnapshotBeforeUpdate=="function"||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||($=T.state,typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount(),$!==T.state&&Lf.enqueueReplaceState(T,T.state,null),Ko(n,u,T,E),Go(),T.state=n.memoizedState),typeof T.componentDidMount=="function"&&(n.flags|=4194308),u=!0}else if(s===null){T=n.stateNode;var K=n.memoizedProps,ne=Hr(a,K);T.props=ne;var pe=T.context,we=a.contextType;$=wa,typeof we=="object"&&we!==null&&($=Hs(we));var ke=a.getDerivedStateFromProps;we=typeof ke=="function"||typeof T.getSnapshotBeforeUpdate=="function",K=n.pendingProps!==K,we||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(K||pe!==$)&&l0(n,T,u,$),sr=!1;var ge=n.memoizedState;T.state=ge,Ko(n,u,T,E),Go(),pe=n.memoizedState,K||ge!==pe||sr?(typeof ke=="function"&&($f(n,a,ke,u),pe=n.memoizedState),(ne=sr||o0(n,a,ne,u,ge,pe,$))?(we||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(n.flags|=4194308)):(typeof T.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=u,n.memoizedState=pe),T.props=u,T.state=pe,T.context=$,u=ne):(typeof T.componentDidMount=="function"&&(n.flags|=4194308),u=!1)}else{T=n.stateNode,hf(s,n),$=n.memoizedProps,we=Hr(a,$),T.props=we,ke=n.pendingProps,ge=T.context,pe=a.contextType,ne=wa,typeof pe=="object"&&pe!==null&&(ne=Hs(pe)),K=a.getDerivedStateFromProps,(pe=typeof K=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||($!==ke||ge!==ne)&&l0(n,T,u,ne),sr=!1,ge=n.memoizedState,T.state=ge,Ko(n,u,T,E),Go();var be=n.memoizedState;$!==ke||ge!==be||sr||s!==null&&s.dependencies!==null&&xc(s.dependencies)?(typeof K=="function"&&($f(n,a,K,u),be=n.memoizedState),(we=sr||o0(n,a,we,u,ge,be,ne)||s!==null&&s.dependencies!==null&&xc(s.dependencies))?(pe||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(u,be,ne),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(u,be,ne)),typeof T.componentDidUpdate=="function"&&(n.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof T.componentDidUpdate!="function"||$===s.memoizedProps&&ge===s.memoizedState||(n.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||$===s.memoizedProps&&ge===s.memoizedState||(n.flags|=1024),n.memoizedProps=u,n.memoizedState=be),T.props=u,T.state=be,T.context=ne,u=we):(typeof T.componentDidUpdate!="function"||$===s.memoizedProps&&ge===s.memoizedState||(n.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||$===s.memoizedProps&&ge===s.memoizedState||(n.flags|=1024),u=!1)}return T=u,Uc(s,n),u=(n.flags&128)!==0,T||u?(T=n.stateNode,a=u&&typeof a.getDerivedStateFromError!="function"?null:T.render(),n.flags|=1,s!==null&&u?(n.child=Pr(n,s.child,null,E),n.child=Pr(n,null,a,E)):zs(s,n,a,E),n.memoizedState=T.state,s=n.child):s=En(s,n,E),s}function x0(s,n,a,u){return Mr(),n.flags|=256,zs(s,n,a,u),n.child}var Hf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function zf(s){return{baseLanes:s,cachePool:h_()}}function Uf(s,n,a){return s=s!==null?s.childLanes&~a:0,n&&(s|=Ei),s}function C0(s,n,a){var u=n.pendingProps,E=!1,T=(n.flags&128)!==0,$;if(($=T)||($=s!==null&&s.memoizedState===null?!1:(bs.current&2)!==0),$&&(E=!0,n.flags&=-129),$=(n.flags&32)!==0,n.flags&=-33,s===null){if(kt){if(E?rr(n):ar(),(s=ss)?(s=My(s,Bi),s=s!==null&&s.data!=="&"?s:null,s!==null&&(n.memoizedState={dehydrated:s,treeContext:Zn!==null?{id:rn,overflow:an}:null,retryLane:536870912,hydrationErrors:null},a=i_(s),a.return=n,n.child=a,Bs=n,ss=null)):s=null,s===null)throw er(n);return Cp(s)?n.lanes=32:n.lanes=536870912,null}var K=u.children;return u=u.fallback,E?(ar(),E=n.mode,K=qc({mode:"hidden",children:K},E),u=Nr(u,E,a,null),K.return=n,u.return=n,K.sibling=u,n.child=K,u=n.child,u.memoizedState=zf(a),u.childLanes=Uf(s,$,a),n.memoizedState=Hf,Qo(null,u)):(rr(n),qf(n,K))}var ne=s.memoizedState;if(ne!==null&&(K=ne.dehydrated,K!==null)){if(T)n.flags&256?(rr(n),n.flags&=-257,n=Ff(s,n,a)):n.memoizedState!==null?(ar(),n.child=s.child,n.flags|=128,n=null):(ar(),K=u.fallback,E=n.mode,u=qc({mode:"visible",children:u.children},E),K=Nr(K,E,a,null),K.flags|=2,u.return=n,K.return=n,u.sibling=K,n.child=u,Pr(n,s.child,null,a),u=n.child,u.memoizedState=zf(a),u.childLanes=Uf(s,$,a),n.memoizedState=Hf,n=Qo(null,u));else if(rr(n),Cp(K)){if($=K.nextSibling&&K.nextSibling.dataset,$)var pe=$.dgst;$=pe,u=Error(r(419)),u.stack="",u.digest=$,zo({value:u,source:null,stack:null}),n=Ff(s,n,a)}else if(js||ka(s,n,a,!1),$=(a&s.childLanes)!==0,js||$){if($=Xt,$!==null&&(u=Is($,a),u!==0&&u!==ne.retryLane))throw ne.retryLane=u,Tr(s,u),pi($,s,u),Pf;xp(K)||Zc(),n=Ff(s,n,a)}else xp(K)?(n.flags|=192,n.child=s.child,n=null):(s=ne.treeContext,ss=zi(K.nextSibling),Bs=n,kt=!0,Qn=null,Bi=!1,s!==null&&a_(n,s),n=qf(n,u.children),n.flags|=4096);return n}return E?(ar(),K=u.fallback,E=n.mode,ne=s.child,pe=ne.sibling,u=yn(ne,{mode:"hidden",children:u.children}),u.subtreeFlags=ne.subtreeFlags&65011712,pe!==null?K=yn(pe,K):(K=Nr(K,E,a,null),K.flags|=2),K.return=n,u.return=n,u.sibling=K,n.child=u,Qo(null,u),u=n.child,K=s.child.memoizedState,K===null?K=zf(a):(E=K.cachePool,E!==null?(ne=ks._currentValue,E=E.parent!==ne?{parent:ne,pool:ne}:E):E=h_(),K={baseLanes:K.baseLanes|a,cachePool:E}),u.memoizedState=K,u.childLanes=Uf(s,$,a),n.memoizedState=Hf,Qo(s.child,u)):(rr(n),a=s.child,s=a.sibling,a=yn(a,{mode:"visible",children:u.children}),a.return=n,a.sibling=null,s!==null&&($=n.deletions,$===null?(n.deletions=[s],n.flags|=16):$.push(s)),n.child=a,n.memoizedState=null,a)}function qf(s,n){return n=qc({mode:"visible",children:n},s.mode),n.return=s,s.child=n}function qc(s,n){return s=Si(22,s,null,n),s.lanes=0,s}function Ff(s,n,a){return Pr(n,s.child,null,a),s=qf(n,n.pendingProps.children),s.flags|=2,n.memoizedState=null,s}function E0(s,n,a){s.lanes|=n;var u=s.alternate;u!==null&&(u.lanes|=n),rf(s.return,n,a)}function Vf(s,n,a,u,E,T){var $=s.memoizedState;$===null?s.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:u,tail:a,tailMode:E,treeForkCount:T}:($.isBackwards=n,$.rendering=null,$.renderingStartTime=0,$.last=u,$.tail=a,$.tailMode=E,$.treeForkCount=T)}function k0(s,n,a){var u=n.pendingProps,E=u.revealOrder,T=u.tail;u=u.children;var $=bs.current,K=($&2)!==0;if(K?($=$&1|2,n.flags|=128):$&=1,U(bs,$),zs(s,n,u,a),u=kt?Ho:0,!K&&s!==null&&(s.flags&128)!==0)e:for(s=n.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&E0(s,a,n);else if(s.tag===19)E0(s,a,n);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break e;for(;s.sibling===null;){if(s.return===null||s.return===n)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(E){case"forwards":for(a=n.child,E=null;a!==null;)s=a.alternate,s!==null&&Nc(s)===null&&(E=a),a=a.sibling;a=E,a===null?(E=n.child,n.child=null):(E=a.sibling,a.sibling=null),Vf(n,!1,E,a,T,u);break;case"backwards":case"unstable_legacy-backwards":for(a=null,E=n.child,n.child=null;E!==null;){if(s=E.alternate,s!==null&&Nc(s)===null){n.child=E;break}s=E.sibling,E.sibling=a,a=E,E=s}Vf(n,!0,a,null,T,u);break;case"together":Vf(n,!1,null,null,void 0,u);break;default:n.memoizedState=null}return n.child}function En(s,n,a){if(s!==null&&(n.dependencies=s.dependencies),cr|=n.lanes,(a&n.childLanes)===0)if(s!==null){if(ka(s,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(s!==null&&n.child!==s.child)throw Error(r(153));if(n.child!==null){for(s=n.child,a=yn(s,s.pendingProps),n.child=a,a.return=n;s.sibling!==null;)s=s.sibling,a=a.sibling=yn(s,s.pendingProps),a.return=n;a.sibling=null}return n.child}function Wf(s,n){return(s.lanes&n)!==0?!0:(s=s.dependencies,!!(s!==null&&xc(s)))}function UE(s,n,a){switch(n.tag){case 3:F(n,n.stateNode.containerInfo),tr(n,ks,s.memoizedState.cache),Mr();break;case 27:case 5:ae(n);break;case 4:F(n,n.stateNode.containerInfo);break;case 10:tr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,gf(n),null;break;case 13:var u=n.memoizedState;if(u!==null)return u.dehydrated!==null?(rr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?C0(s,n,a):(rr(n),s=En(s,n,a),s!==null?s.sibling:null);rr(n);break;case 19:var E=(s.flags&128)!==0;if(u=(a&n.childLanes)!==0,u||(ka(s,n,a,!1),u=(a&n.childLanes)!==0),E){if(u)return k0(s,n,a);n.flags|=128}if(E=n.memoizedState,E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),U(bs,bs.current),u)break;return null;case 22:return n.lanes=0,_0(s,n,a,n.pendingProps);case 24:tr(n,ks,s.memoizedState.cache)}return En(s,n,a)}function A0(s,n,a){if(s!==null)if(s.memoizedProps!==n.pendingProps)js=!0;else{if(!Wf(s,a)&&(n.flags&128)===0)return js=!1,UE(s,n,a);js=(s.flags&131072)!==0}else js=!1,kt&&(n.flags&1048576)!==0&&r_(n,Ho,n.index);switch(n.lanes=0,n.tag){case 16:e:{var u=n.pendingProps;if(s=Lr(n.elementType),n.type=s,typeof s=="function")Xh(s)?(u=Hr(s,u),n.tag=1,n=w0(null,n,s,u,a)):(n.tag=0,n=Bf(null,n,s,u,a));else{if(s!=null){var E=s.$$typeof;if(E===k){n.tag=11,n=m0(null,n,s,u,a);break e}else if(E===N){n.tag=14,n=v0(null,n,s,u,a);break e}}throw n=J(s)||s,Error(r(306,n,""))}}return n;case 0:return Bf(s,n,n.type,n.pendingProps,a);case 1:return u=n.type,E=Hr(u,n.pendingProps),w0(s,n,u,E,a);case 3:e:{if(F(n,n.stateNode.containerInfo),s===null)throw Error(r(387));u=n.pendingProps;var T=n.memoizedState;E=T.element,hf(s,n),Ko(n,u,null,a);var $=n.memoizedState;if(u=$.cache,tr(n,ks,u),u!==T.cache&&af(n,[ks],a,!0),Go(),u=$.element,T.isDehydrated)if(T={element:u,isDehydrated:!1,cache:$.cache},n.updateQueue.baseState=T,n.memoizedState=T,n.flags&256){n=x0(s,n,u,a);break e}else if(u!==E){E=Li(Error(r(424)),n),zo(E),n=x0(s,n,u,a);break e}else{switch(s=n.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(ss=zi(s.firstChild),Bs=n,kt=!0,Qn=null,Bi=!0,a=__(n,null,u,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Mr(),u===E){n=En(s,n,a);break e}zs(s,n,u,a)}n=n.child}return n;case 26:return Uc(s,n),s===null?(a=Py(n.type,null,n.pendingProps,null))?n.memoizedState=a:kt||(a=n.type,s=n.pendingProps,u=ru(se.current).createElement(a),u[fe]=n,u[ye]=s,Us(u,a,s),Ke(u),n.stateNode=u):n.memoizedState=Py(n.type,s.memoizedProps,n.pendingProps,s.memoizedState),null;case 27:return ae(n),s===null&&kt&&(u=n.stateNode=$y(n.type,n.pendingProps,se.current),Bs=n,Bi=!0,E=ss,pr(n.type)?(Ep=E,ss=zi(u.firstChild)):ss=E),zs(s,n,n.pendingProps.children,a),Uc(s,n),s===null&&(n.flags|=4194304),n.child;case 5:return s===null&&kt&&((E=u=ss)&&(u=_k(u,n.type,n.pendingProps,Bi),u!==null?(n.stateNode=u,Bs=n,ss=zi(u.firstChild),Bi=!1,E=!0):E=!1),E||er(n)),ae(n),E=n.type,T=n.pendingProps,$=s!==null?s.memoizedProps:null,u=T.children,bp(E,T)?u=null:$!==null&&bp(E,$)&&(n.flags|=32),n.memoizedState!==null&&(E=yf(s,n,DE,null,null,a),pl._currentValue=E),Uc(s,n),zs(s,n,u,a),n.child;case 6:return s===null&&kt&&((s=a=ss)&&(a=yk(a,n.pendingProps,Bi),a!==null?(n.stateNode=a,Bs=n,ss=null,s=!0):s=!1),s||er(n)),null;case 13:return C0(s,n,a);case 4:return F(n,n.stateNode.containerInfo),u=n.pendingProps,s===null?n.child=Pr(n,null,u,a):zs(s,n,u,a),n.child;case 11:return m0(s,n,n.type,n.pendingProps,a);case 7:return zs(s,n,n.pendingProps,a),n.child;case 8:return zs(s,n,n.pendingProps.children,a),n.child;case 12:return zs(s,n,n.pendingProps.children,a),n.child;case 10:return u=n.pendingProps,tr(n,n.type,u.value),zs(s,n,u.children,a),n.child;case 9:return E=n.type._context,u=n.pendingProps.children,Or(n),E=Hs(E),u=u(E),n.flags|=1,zs(s,n,u,a),n.child;case 14:return v0(s,n,n.type,n.pendingProps,a);case 15:return g0(s,n,n.type,n.pendingProps,a);case 19:return k0(s,n,a);case 31:return zE(s,n,a);case 22:return _0(s,n,a,n.pendingProps);case 24:return Or(n),u=Hs(ks),s===null?(E=cf(),E===null&&(E=Xt,T=of(),E.pooledCache=T,T.refCount++,T!==null&&(E.pooledCacheLanes|=a),E=T),n.memoizedState={parent:u,cache:E},df(n),tr(n,ks,E)):((s.lanes&a)!==0&&(hf(s,n),Ko(n,null,null,a),Go()),E=s.memoizedState,T=n.memoizedState,E.parent!==u?(E={parent:u,cache:u},n.memoizedState=E,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=E),tr(n,ks,u)):(u=T.cache,tr(n,ks,u),u!==E.cache&&af(n,[ks],a,!0))),zs(s,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function kn(s){s.flags|=4}function Gf(s,n,a,u,E){if((n=(s.mode&32)!==0)&&(n=!1),n){if(s.flags|=16777216,(E&335544128)===E)if(s.stateNode.complete)s.flags|=8192;else if(ey())s.flags|=8192;else throw Ir=Ac,uf}else s.flags&=-16777217}function j0(s,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!qy(n))if(ey())s.flags|=8192;else throw Ir=Ac,uf}function Fc(s,n){n!==null&&(s.flags|=4),s.flags&16384&&(n=s.tag!==22?_i():536870912,s.lanes|=n,Pa|=n)}function el(s,n){if(!kt)switch(s.tailMode){case"hidden":n=s.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?s.tail=null:a.sibling=null;break;case"collapsed":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?n||s.tail===null?s.tail=null:s.tail.sibling=null:u.sibling=null}}function is(s){var n=s.alternate!==null&&s.alternate.child===s.child,a=0,u=0;if(n)for(var E=s.child;E!==null;)a|=E.lanes|E.childLanes,u|=E.subtreeFlags&65011712,u|=E.flags&65011712,E.return=s,E=E.sibling;else for(E=s.child;E!==null;)a|=E.lanes|E.childLanes,u|=E.subtreeFlags,u|=E.flags,E.return=s,E=E.sibling;return s.subtreeFlags|=u,s.childLanes=a,n}function qE(s,n,a){var u=n.pendingProps;switch(ef(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return is(n),null;case 1:return is(n),null;case 3:return a=n.stateNode,u=null,s!==null&&(u=s.memoizedState.cache),n.memoizedState.cache!==u&&(n.flags|=2048),wn(ks),le(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(s===null||s.child===null)&&(Ea(n)?kn(n):s===null||s.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,sf())),is(n),null;case 26:var E=n.type,T=n.memoizedState;return s===null?(kn(n),T!==null?(is(n),j0(n,T)):(is(n),Gf(n,E,null,u,a))):T?T!==s.memoizedState?(kn(n),is(n),j0(n,T)):(is(n),n.flags&=-16777217):(s=s.memoizedProps,s!==u&&kn(n),is(n),Gf(n,E,s,u,a)),null;case 27:if(X(n),a=se.current,E=n.type,s!==null&&n.stateNode!=null)s.memoizedProps!==u&&kn(n);else{if(!u){if(n.stateNode===null)throw Error(r(166));return is(n),null}s=L.current,Ea(n)?o_(n):(s=$y(E,u,a),n.stateNode=s,kn(n))}return is(n),null;case 5:if(X(n),E=n.type,s!==null&&n.stateNode!=null)s.memoizedProps!==u&&kn(n);else{if(!u){if(n.stateNode===null)throw Error(r(166));return is(n),null}if(T=L.current,Ea(n))o_(n);else{var $=ru(se.current);switch(T){case 1:T=$.createElementNS("http://www.w3.org/2000/svg",E);break;case 2:T=$.createElementNS("http://www.w3.org/1998/Math/MathML",E);break;default:switch(E){case"svg":T=$.createElementNS("http://www.w3.org/2000/svg",E);break;case"math":T=$.createElementNS("http://www.w3.org/1998/Math/MathML",E);break;case"script":T=$.createElement("div"),T.innerHTML="<script><\/script>",T=T.removeChild(T.firstChild);break;case"select":T=typeof u.is=="string"?$.createElement("select",{is:u.is}):$.createElement("select"),u.multiple?T.multiple=!0:u.size&&(T.size=u.size);break;default:T=typeof u.is=="string"?$.createElement(E,{is:u.is}):$.createElement(E)}}T[fe]=n,T[ye]=u;e:for($=n.child;$!==null;){if($.tag===5||$.tag===6)T.appendChild($.stateNode);else if($.tag!==4&&$.tag!==27&&$.child!==null){$.child.return=$,$=$.child;continue}if($===n)break e;for(;$.sibling===null;){if($.return===null||$.return===n)break e;$=$.return}$.sibling.return=$.return,$=$.sibling}n.stateNode=T;e:switch(Us(T,E,u),E){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&kn(n)}}return is(n),Gf(n,n.type,s===null?null:s.memoizedProps,n.pendingProps,a),null;case 6:if(s&&n.stateNode!=null)s.memoizedProps!==u&&kn(n);else{if(typeof u!="string"&&n.stateNode===null)throw Error(r(166));if(s=se.current,Ea(n)){if(s=n.stateNode,a=n.memoizedProps,u=null,E=Bs,E!==null)switch(E.tag){case 27:case 5:u=E.memoizedProps}s[fe]=n,s=!!(s.nodeValue===a||u!==null&&u.suppressHydrationWarning===!0||Cy(s.nodeValue,a)),s||er(n,!0)}else s=ru(s).createTextNode(u),s[fe]=n,n.stateNode=s}return is(n),null;case 31:if(a=n.memoizedState,s===null||s.memoizedState!==null){if(u=Ea(n),a!==null){if(s===null){if(!u)throw Error(r(318));if(s=n.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[fe]=n}else Mr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;is(n),s=!1}else a=sf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=a),s=!0;if(!s)return n.flags&256?(xi(n),n):(xi(n),null);if((n.flags&128)!==0)throw Error(r(558))}return is(n),null;case 13:if(u=n.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(E=Ea(n),u!==null&&u.dehydrated!==null){if(s===null){if(!E)throw Error(r(318));if(E=n.memoizedState,E=E!==null?E.dehydrated:null,!E)throw Error(r(317));E[fe]=n}else Mr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;is(n),E=!1}else E=sf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=E),E=!0;if(!E)return n.flags&256?(xi(n),n):(xi(n),null)}return xi(n),(n.flags&128)!==0?(n.lanes=a,n):(a=u!==null,s=s!==null&&s.memoizedState!==null,a&&(u=n.child,E=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(E=u.alternate.memoizedState.cachePool.pool),T=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(T=u.memoizedState.cachePool.pool),T!==E&&(u.flags|=2048)),a!==s&&a&&(n.child.flags|=8192),Fc(n,n.updateQueue),is(n),null);case 4:return le(),s===null&&mp(n.stateNode.containerInfo),is(n),null;case 10:return wn(n.type),is(n),null;case 19:if(H(bs),u=n.memoizedState,u===null)return is(n),null;if(E=(n.flags&128)!==0,T=u.rendering,T===null)if(E)el(u,!1);else{if(gs!==0||s!==null&&(s.flags&128)!==0)for(s=n.child;s!==null;){if(T=Nc(s),T!==null){for(n.flags|=128,el(u,!1),s=T.updateQueue,n.updateQueue=s,Fc(n,s),n.subtreeFlags=0,s=a,a=n.child;a!==null;)s_(a,s),a=a.sibling;return U(bs,bs.current&1|2),kt&&bn(n,u.treeForkCount),n.child}s=s.sibling}u.tail!==null&&Je()>Yc&&(n.flags|=128,E=!0,el(u,!1),n.lanes=4194304)}else{if(!E)if(s=Nc(T),s!==null){if(n.flags|=128,E=!0,s=s.updateQueue,n.updateQueue=s,Fc(n,s),el(u,!0),u.tail===null&&u.tailMode==="hidden"&&!T.alternate&&!kt)return is(n),null}else 2*Je()-u.renderingStartTime>Yc&&a!==536870912&&(n.flags|=128,E=!0,el(u,!1),n.lanes=4194304);u.isBackwards?(T.sibling=n.child,n.child=T):(s=u.last,s!==null?s.sibling=T:n.child=T,u.last=T)}return u.tail!==null?(s=u.tail,u.rendering=s,u.tail=s.sibling,u.renderingStartTime=Je(),s.sibling=null,a=bs.current,U(bs,E?a&1|2:a&1),kt&&bn(n,u.treeForkCount),s):(is(n),null);case 22:case 23:return xi(n),vf(),u=n.memoizedState!==null,s!==null?s.memoizedState!==null!==u&&(n.flags|=8192):u&&(n.flags|=8192),u?(a&536870912)!==0&&(n.flags&128)===0&&(is(n),n.subtreeFlags&6&&(n.flags|=8192)):is(n),a=n.updateQueue,a!==null&&Fc(n,a.retryQueue),a=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),u=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(u=n.memoizedState.cachePool.pool),u!==a&&(n.flags|=2048),s!==null&&H($r),null;case 24:return a=null,s!==null&&(a=s.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),wn(ks),is(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function FE(s,n){switch(ef(n),n.tag){case 1:return s=n.flags,s&65536?(n.flags=s&-65537|128,n):null;case 3:return wn(ks),le(),s=n.flags,(s&65536)!==0&&(s&128)===0?(n.flags=s&-65537|128,n):null;case 26:case 27:case 5:return X(n),null;case 31:if(n.memoizedState!==null){if(xi(n),n.alternate===null)throw Error(r(340));Mr()}return s=n.flags,s&65536?(n.flags=s&-65537|128,n):null;case 13:if(xi(n),s=n.memoizedState,s!==null&&s.dehydrated!==null){if(n.alternate===null)throw Error(r(340));Mr()}return s=n.flags,s&65536?(n.flags=s&-65537|128,n):null;case 19:return H(bs),null;case 4:return le(),null;case 10:return wn(n.type),null;case 22:case 23:return xi(n),vf(),s!==null&&H($r),s=n.flags,s&65536?(n.flags=s&-65537|128,n):null;case 24:return wn(ks),null;case 25:return null;default:return null}}function R0(s,n){switch(ef(n),n.tag){case 3:wn(ks),le();break;case 26:case 27:case 5:X(n);break;case 4:le();break;case 31:n.memoizedState!==null&&xi(n);break;case 13:xi(n);break;case 19:H(bs);break;case 10:wn(n.type);break;case 22:case 23:xi(n),vf(),s!==null&&H($r);break;case 24:wn(ks)}}function tl(s,n){try{var a=n.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var E=u.next;a=E;do{if((a.tag&s)===s){u=void 0;var T=a.create,$=a.inst;u=T(),$.destroy=u}a=a.next}while(a!==E)}}catch(K){zt(n,n.return,K)}}function or(s,n,a){try{var u=n.updateQueue,E=u!==null?u.lastEffect:null;if(E!==null){var T=E.next;u=T;do{if((u.tag&s)===s){var $=u.inst,K=$.destroy;if(K!==void 0){$.destroy=void 0,E=n;var ne=a,pe=K;try{pe()}catch(we){zt(E,ne,we)}}}u=u.next}while(u!==T)}}catch(we){zt(n,n.return,we)}}function T0(s){var n=s.updateQueue;if(n!==null){var a=s.stateNode;try{b_(n,a)}catch(u){zt(s,s.return,u)}}}function N0(s,n,a){a.props=Hr(s.type,s.memoizedProps),a.state=s.memoizedState;try{a.componentWillUnmount()}catch(u){zt(s,n,u)}}function sl(s,n){try{var a=s.ref;if(a!==null){switch(s.tag){case 26:case 27:case 5:var u=s.stateNode;break;case 30:u=s.stateNode;break;default:u=s.stateNode}typeof a=="function"?s.refCleanup=a(u):a.current=u}}catch(E){zt(s,n,E)}}function on(s,n){var a=s.ref,u=s.refCleanup;if(a!==null)if(typeof u=="function")try{u()}catch(E){zt(s,n,E)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(E){zt(s,n,E)}else a.current=null}function M0(s){var n=s.type,a=s.memoizedProps,u=s.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&u.focus();break e;case"img":a.src?u.src=a.src:a.srcSet&&(u.srcset=a.srcSet)}}catch(E){zt(s,s.return,E)}}function Kf(s,n,a){try{var u=s.stateNode;hk(u,s.type,a,n),u[ye]=n}catch(E){zt(s,s.return,E)}}function D0(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&pr(s.type)||s.tag===4}function Yf(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||D0(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&&pr(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 Xf(s,n,a){var u=s.tag;if(u===5||u===6)s=s.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(s,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(s),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=Oi));else if(u!==4&&(u===27&&pr(s.type)&&(a=s.stateNode,n=null),s=s.child,s!==null))for(Xf(s,n,a),s=s.sibling;s!==null;)Xf(s,n,a),s=s.sibling}function Vc(s,n,a){var u=s.tag;if(u===5||u===6)s=s.stateNode,n?a.insertBefore(s,n):a.appendChild(s);else if(u!==4&&(u===27&&pr(s.type)&&(a=s.stateNode),s=s.child,s!==null))for(Vc(s,n,a),s=s.sibling;s!==null;)Vc(s,n,a),s=s.sibling}function O0(s){var n=s.stateNode,a=s.memoizedProps;try{for(var u=s.type,E=n.attributes;E.length;)n.removeAttributeNode(E[0]);Us(n,u,a),n[fe]=s,n[ye]=a}catch(T){zt(s,s.return,T)}}var An=!1,Rs=!1,Jf=!1,$0=typeof WeakSet=="function"?WeakSet:Set,Ps=null;function VE(s,n){if(s=s.containerInfo,_p=hu,s=Gg(s),qh(s)){if("selectionStart"in s)var a={start:s.selectionStart,end:s.selectionEnd};else e:{a=(a=s.ownerDocument)&&a.defaultView||window;var u=a.getSelection&&a.getSelection();if(u&&u.rangeCount!==0){a=u.anchorNode;var E=u.anchorOffset,T=u.focusNode;u=u.focusOffset;try{a.nodeType,T.nodeType}catch{a=null;break e}var $=0,K=-1,ne=-1,pe=0,we=0,ke=s,ge=null;t:for(;;){for(var be;ke!==a||E!==0&&ke.nodeType!==3||(K=$+E),ke!==T||u!==0&&ke.nodeType!==3||(ne=$+u),ke.nodeType===3&&($+=ke.nodeValue.length),(be=ke.firstChild)!==null;)ge=ke,ke=be;for(;;){if(ke===s)break t;if(ge===a&&++pe===E&&(K=$),ge===T&&++we===u&&(ne=$),(be=ke.nextSibling)!==null)break;ke=ge,ge=ke.parentNode}ke=be}a=K===-1||ne===-1?null:{start:K,end:ne}}else a=null}a=a||{start:0,end:0}}else a=null;for(yp={focusedElem:s,selectionRange:a},hu=!1,Ps=n;Ps!==null;)if(n=Ps,s=n.child,(n.subtreeFlags&1028)!==0&&s!==null)s.return=n,Ps=s;else for(;Ps!==null;){switch(n=Ps,T=n.alternate,s=n.flags,n.tag){case 0:if((s&4)!==0&&(s=n.updateQueue,s=s!==null?s.events:null,s!==null))for(a=0;a<s.length;a++)E=s[a],E.ref.impl=E.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&T!==null){s=void 0,a=n,E=T.memoizedProps,T=T.memoizedState,u=a.stateNode;try{var Ue=Hr(a.type,E);s=u.getSnapshotBeforeUpdate(Ue,T),u.__reactInternalSnapshotBeforeUpdate=s}catch(tt){zt(a,a.return,tt)}}break;case 3:if((s&1024)!==0){if(s=n.stateNode.containerInfo,a=s.nodeType,a===9)wp(s);else if(a===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":wp(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=n.sibling,s!==null){s.return=n.return,Ps=s;break}Ps=n.return}}function L0(s,n,a){var u=a.flags;switch(a.tag){case 0:case 11:case 15:Rn(s,a),u&4&&tl(5,a);break;case 1:if(Rn(s,a),u&4)if(s=a.stateNode,n===null)try{s.componentDidMount()}catch($){zt(a,a.return,$)}else{var E=Hr(a.type,n.memoizedProps);n=n.memoizedState;try{s.componentDidUpdate(E,n,s.__reactInternalSnapshotBeforeUpdate)}catch($){zt(a,a.return,$)}}u&64&&T0(a),u&512&&sl(a,a.return);break;case 3:if(Rn(s,a),u&64&&(s=a.updateQueue,s!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{b_(s,n)}catch($){zt(a,a.return,$)}}break;case 27:n===null&&u&4&&O0(a);case 26:case 5:Rn(s,a),n===null&&u&4&&M0(a),u&512&&sl(a,a.return);break;case 12:Rn(s,a);break;case 31:Rn(s,a),u&4&&B0(s,a);break;case 13:Rn(s,a),u&4&&H0(s,a),u&64&&(s=a.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(a=ek.bind(null,a),bk(s,a))));break;case 22:if(u=a.memoizedState!==null||An,!u){n=n!==null&&n.memoizedState!==null||Rs,E=An;var T=Rs;An=u,(Rs=n)&&!T?Tn(s,a,(a.subtreeFlags&8772)!==0):Rn(s,a),An=E,Rs=T}break;case 30:break;default:Rn(s,a)}}function I0(s){var n=s.alternate;n!==null&&(s.alternate=null,I0(n)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(n=s.stateNode,n!==null&&Ct(n)),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 ls=null,ui=!1;function jn(s,n,a){for(a=a.child;a!==null;)P0(s,n,a),a=a.sibling}function P0(s,n,a){if(Lt&&typeof Lt.onCommitFiberUnmount=="function")try{Lt.onCommitFiberUnmount(xs,a)}catch{}switch(a.tag){case 26:Rs||on(a,n),jn(s,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Rs||on(a,n);var u=ls,E=ui;pr(a.type)&&(ls=a.stateNode,ui=!1),jn(s,n,a),dl(a.stateNode),ls=u,ui=E;break;case 5:Rs||on(a,n);case 6:if(u=ls,E=ui,ls=null,jn(s,n,a),ls=u,ui=E,ls!==null)if(ui)try{(ls.nodeType===9?ls.body:ls.nodeName==="HTML"?ls.ownerDocument.body:ls).removeChild(a.stateNode)}catch(T){zt(a,n,T)}else try{ls.removeChild(a.stateNode)}catch(T){zt(a,n,T)}break;case 18:ls!==null&&(ui?(s=ls,Ty(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,a.stateNode),Wa(s)):Ty(ls,a.stateNode));break;case 4:u=ls,E=ui,ls=a.stateNode.containerInfo,ui=!0,jn(s,n,a),ls=u,ui=E;break;case 0:case 11:case 14:case 15:or(2,a,n),Rs||or(4,a,n),jn(s,n,a);break;case 1:Rs||(on(a,n),u=a.stateNode,typeof u.componentWillUnmount=="function"&&N0(a,n,u)),jn(s,n,a);break;case 21:jn(s,n,a);break;case 22:Rs=(u=Rs)||a.memoizedState!==null,jn(s,n,a),Rs=u;break;default:jn(s,n,a)}}function B0(s,n){if(n.memoizedState===null&&(s=n.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Wa(s)}catch(a){zt(n,n.return,a)}}}function H0(s,n){if(n.memoizedState===null&&(s=n.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Wa(s)}catch(a){zt(n,n.return,a)}}function WE(s){switch(s.tag){case 31:case 13:case 19:var n=s.stateNode;return n===null&&(n=s.stateNode=new $0),n;case 22:return s=s.stateNode,n=s._retryCache,n===null&&(n=s._retryCache=new $0),n;default:throw Error(r(435,s.tag))}}function Wc(s,n){var a=WE(s);n.forEach(function(u){if(!a.has(u)){a.add(u);var E=tk.bind(null,s,u);u.then(E,E)}})}function di(s,n){var a=n.deletions;if(a!==null)for(var u=0;u<a.length;u++){var E=a[u],T=s,$=n,K=$;e:for(;K!==null;){switch(K.tag){case 27:if(pr(K.type)){ls=K.stateNode,ui=!1;break e}break;case 5:ls=K.stateNode,ui=!1;break e;case 3:case 4:ls=K.stateNode.containerInfo,ui=!0;break e}K=K.return}if(ls===null)throw Error(r(160));P0(T,$,E),ls=null,ui=!1,T=E.alternate,T!==null&&(T.return=null),E.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)z0(n,s),n=n.sibling}var Ki=null;function z0(s,n){var a=s.alternate,u=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:di(n,s),hi(s),u&4&&(or(3,s,s.return),tl(3,s),or(5,s,s.return));break;case 1:di(n,s),hi(s),u&512&&(Rs||a===null||on(a,a.return)),u&64&&An&&(s=s.updateQueue,s!==null&&(u=s.callbacks,u!==null&&(a=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=a===null?u:a.concat(u))));break;case 26:var E=Ki;if(di(n,s),hi(s),u&512&&(Rs||a===null||on(a,a.return)),u&4){var T=a!==null?a.memoizedState:null;if(u=s.memoizedState,a===null)if(u===null)if(s.stateNode===null){e:{u=s.type,a=s.memoizedProps,E=E.ownerDocument||E;t:switch(u){case"title":T=E.getElementsByTagName("title")[0],(!T||T[Rt]||T[fe]||T.namespaceURI==="http://www.w3.org/2000/svg"||T.hasAttribute("itemprop"))&&(T=E.createElement(u),E.head.insertBefore(T,E.querySelector("head > title"))),Us(T,u,a),T[fe]=s,Ke(T),u=T;break e;case"link":var $=zy("link","href",E).get(u+(a.href||""));if($){for(var K=0;K<$.length;K++)if(T=$[K],T.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&T.getAttribute("rel")===(a.rel==null?null:a.rel)&&T.getAttribute("title")===(a.title==null?null:a.title)&&T.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){$.splice(K,1);break t}}T=E.createElement(u),Us(T,u,a),E.head.appendChild(T);break;case"meta":if($=zy("meta","content",E).get(u+(a.content||""))){for(K=0;K<$.length;K++)if(T=$[K],T.getAttribute("content")===(a.content==null?null:""+a.content)&&T.getAttribute("name")===(a.name==null?null:a.name)&&T.getAttribute("property")===(a.property==null?null:a.property)&&T.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&T.getAttribute("charset")===(a.charSet==null?null:a.charSet)){$.splice(K,1);break t}}T=E.createElement(u),Us(T,u,a),E.head.appendChild(T);break;default:throw Error(r(468,u))}T[fe]=s,Ke(T),u=T}s.stateNode=u}else Uy(E,s.type,s.stateNode);else s.stateNode=Hy(E,u,s.memoizedProps);else T!==u?(T===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):T.count--,u===null?Uy(E,s.type,s.stateNode):Hy(E,u,s.memoizedProps)):u===null&&s.stateNode!==null&&Kf(s,s.memoizedProps,a.memoizedProps)}break;case 27:di(n,s),hi(s),u&512&&(Rs||a===null||on(a,a.return)),a!==null&&u&4&&Kf(s,s.memoizedProps,a.memoizedProps);break;case 5:if(di(n,s),hi(s),u&512&&(Rs||a===null||on(a,a.return)),s.flags&32){E=s.stateNode;try{vn(E,"")}catch(Ue){zt(s,s.return,Ue)}}u&4&&s.stateNode!=null&&(E=s.memoizedProps,Kf(s,E,a!==null?a.memoizedProps:E)),u&1024&&(Jf=!0);break;case 6:if(di(n,s),hi(s),u&4){if(s.stateNode===null)throw Error(r(162));u=s.memoizedProps,a=s.stateNode;try{a.nodeValue=u}catch(Ue){zt(s,s.return,Ue)}}break;case 3:if(lu=null,E=Ki,Ki=au(n.containerInfo),di(n,s),Ki=E,hi(s),u&4&&a!==null&&a.memoizedState.isDehydrated)try{Wa(n.containerInfo)}catch(Ue){zt(s,s.return,Ue)}Jf&&(Jf=!1,U0(s));break;case 4:u=Ki,Ki=au(s.stateNode.containerInfo),di(n,s),hi(s),Ki=u;break;case 12:di(n,s),hi(s);break;case 31:di(n,s),hi(s),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,Wc(s,u)));break;case 13:di(n,s),hi(s),s.child.flags&8192&&s.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Kc=Je()),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,Wc(s,u)));break;case 22:E=s.memoizedState!==null;var ne=a!==null&&a.memoizedState!==null,pe=An,we=Rs;if(An=pe||E,Rs=we||ne,di(n,s),Rs=we,An=pe,hi(s),u&8192)e:for(n=s.stateNode,n._visibility=E?n._visibility&-2:n._visibility|1,E&&(a===null||ne||An||Rs||zr(s)),a=null,n=s;;){if(n.tag===5||n.tag===26){if(a===null){ne=a=n;try{if(T=ne.stateNode,E)$=T.style,typeof $.setProperty=="function"?$.setProperty("display","none","important"):$.display="none";else{K=ne.stateNode;var ke=ne.memoizedProps.style,ge=ke!=null&&ke.hasOwnProperty("display")?ke.display:null;K.style.display=ge==null||typeof ge=="boolean"?"":(""+ge).trim()}}catch(Ue){zt(ne,ne.return,Ue)}}}else if(n.tag===6){if(a===null){ne=n;try{ne.stateNode.nodeValue=E?"":ne.memoizedProps}catch(Ue){zt(ne,ne.return,Ue)}}}else if(n.tag===18){if(a===null){ne=n;try{var be=ne.stateNode;E?Ny(be,!0):Ny(ne.stateNode,!1)}catch(Ue){zt(ne,ne.return,Ue)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===s)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===s)break e;for(;n.sibling===null;){if(n.return===null||n.return===s)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}u&4&&(u=s.updateQueue,u!==null&&(a=u.retryQueue,a!==null&&(u.retryQueue=null,Wc(s,a))));break;case 19:di(n,s),hi(s),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,Wc(s,u)));break;case 30:break;case 21:break;default:di(n,s),hi(s)}}function hi(s){var n=s.flags;if(n&2){try{for(var a,u=s.return;u!==null;){if(D0(u)){a=u;break}u=u.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var E=a.stateNode,T=Yf(s);Vc(s,T,E);break;case 5:var $=a.stateNode;a.flags&32&&(vn($,""),a.flags&=-33);var K=Yf(s);Vc(s,K,$);break;case 3:case 4:var ne=a.stateNode.containerInfo,pe=Yf(s);Xf(s,pe,ne);break;default:throw Error(r(161))}}catch(we){zt(s,s.return,we)}s.flags&=-3}n&4096&&(s.flags&=-4097)}function U0(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var n=s;U0(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),s=s.sibling}}function Rn(s,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)L0(s,n.alternate,n),n=n.sibling}function zr(s){for(s=s.child;s!==null;){var n=s;switch(n.tag){case 0:case 11:case 14:case 15:or(4,n,n.return),zr(n);break;case 1:on(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&N0(n,n.return,a),zr(n);break;case 27:dl(n.stateNode);case 26:case 5:on(n,n.return),zr(n);break;case 22:n.memoizedState===null&&zr(n);break;case 30:zr(n);break;default:zr(n)}s=s.sibling}}function Tn(s,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var u=n.alternate,E=s,T=n,$=T.flags;switch(T.tag){case 0:case 11:case 15:Tn(E,T,a),tl(4,T);break;case 1:if(Tn(E,T,a),u=T,E=u.stateNode,typeof E.componentDidMount=="function")try{E.componentDidMount()}catch(pe){zt(u,u.return,pe)}if(u=T,E=u.updateQueue,E!==null){var K=u.stateNode;try{var ne=E.shared.hiddenCallbacks;if(ne!==null)for(E.shared.hiddenCallbacks=null,E=0;E<ne.length;E++)y_(ne[E],K)}catch(pe){zt(u,u.return,pe)}}a&&$&64&&T0(T),sl(T,T.return);break;case 27:O0(T);case 26:case 5:Tn(E,T,a),a&&u===null&&$&4&&M0(T),sl(T,T.return);break;case 12:Tn(E,T,a);break;case 31:Tn(E,T,a),a&&$&4&&B0(E,T);break;case 13:Tn(E,T,a),a&&$&4&&H0(E,T);break;case 22:T.memoizedState===null&&Tn(E,T,a),sl(T,T.return);break;case 30:break;default:Tn(E,T,a)}n=n.sibling}}function Zf(s,n){var a=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==a&&(s!=null&&s.refCount++,a!=null&&Uo(a))}function Qf(s,n){s=null,n.alternate!==null&&(s=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==s&&(n.refCount++,s!=null&&Uo(s))}function Yi(s,n,a,u){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)q0(s,n,a,u),n=n.sibling}function q0(s,n,a,u){var E=n.flags;switch(n.tag){case 0:case 11:case 15:Yi(s,n,a,u),E&2048&&tl(9,n);break;case 1:Yi(s,n,a,u);break;case 3:Yi(s,n,a,u),E&2048&&(s=null,n.alternate!==null&&(s=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==s&&(n.refCount++,s!=null&&Uo(s)));break;case 12:if(E&2048){Yi(s,n,a,u),s=n.stateNode;try{var T=n.memoizedProps,$=T.id,K=T.onPostCommit;typeof K=="function"&&K($,n.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(ne){zt(n,n.return,ne)}}else Yi(s,n,a,u);break;case 31:Yi(s,n,a,u);break;case 13:Yi(s,n,a,u);break;case 23:break;case 22:T=n.stateNode,$=n.alternate,n.memoizedState!==null?T._visibility&2?Yi(s,n,a,u):il(s,n):T._visibility&2?Yi(s,n,a,u):(T._visibility|=2,$a(s,n,a,u,(n.subtreeFlags&10256)!==0||!1)),E&2048&&Zf($,n);break;case 24:Yi(s,n,a,u),E&2048&&Qf(n.alternate,n);break;default:Yi(s,n,a,u)}}function $a(s,n,a,u,E){for(E=E&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var T=s,$=n,K=a,ne=u,pe=$.flags;switch($.tag){case 0:case 11:case 15:$a(T,$,K,ne,E),tl(8,$);break;case 23:break;case 22:var we=$.stateNode;$.memoizedState!==null?we._visibility&2?$a(T,$,K,ne,E):il(T,$):(we._visibility|=2,$a(T,$,K,ne,E)),E&&pe&2048&&Zf($.alternate,$);break;case 24:$a(T,$,K,ne,E),E&&pe&2048&&Qf($.alternate,$);break;default:$a(T,$,K,ne,E)}n=n.sibling}}function il(s,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=s,u=n,E=u.flags;switch(u.tag){case 22:il(a,u),E&2048&&Zf(u.alternate,u);break;case 24:il(a,u),E&2048&&Qf(u.alternate,u);break;default:il(a,u)}n=n.sibling}}var nl=8192;function La(s,n,a){if(s.subtreeFlags&nl)for(s=s.child;s!==null;)F0(s,n,a),s=s.sibling}function F0(s,n,a){switch(s.tag){case 26:La(s,n,a),s.flags&nl&&s.memoizedState!==null&&Mk(a,Ki,s.memoizedState,s.memoizedProps);break;case 5:La(s,n,a);break;case 3:case 4:var u=Ki;Ki=au(s.stateNode.containerInfo),La(s,n,a),Ki=u;break;case 22:s.memoizedState===null&&(u=s.alternate,u!==null&&u.memoizedState!==null?(u=nl,nl=16777216,La(s,n,a),nl=u):La(s,n,a));break;default:La(s,n,a)}}function V0(s){var n=s.alternate;if(n!==null&&(s=n.child,s!==null)){n.child=null;do n=s.sibling,s.sibling=null,s=n;while(s!==null)}}function rl(s){var n=s.deletions;if((s.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var u=n[a];Ps=u,G0(u,s)}V0(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)W0(s),s=s.sibling}function W0(s){switch(s.tag){case 0:case 11:case 15:rl(s),s.flags&2048&&or(9,s,s.return);break;case 3:rl(s);break;case 12:rl(s);break;case 22:var n=s.stateNode;s.memoizedState!==null&&n._visibility&2&&(s.return===null||s.return.tag!==13)?(n._visibility&=-3,Gc(s)):rl(s);break;default:rl(s)}}function Gc(s){var n=s.deletions;if((s.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var u=n[a];Ps=u,G0(u,s)}V0(s)}for(s=s.child;s!==null;){switch(n=s,n.tag){case 0:case 11:case 15:or(8,n,n.return),Gc(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Gc(n));break;default:Gc(n)}s=s.sibling}}function G0(s,n){for(;Ps!==null;){var a=Ps;switch(a.tag){case 0:case 11:case 15:or(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var u=a.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Uo(a.memoizedState.cache)}if(u=a.child,u!==null)u.return=a,Ps=u;else e:for(a=s;Ps!==null;){u=Ps;var E=u.sibling,T=u.return;if(I0(u),u===a){Ps=null;break e}if(E!==null){E.return=T,Ps=E;break e}Ps=T}}}var GE={getCacheForType:function(s){var n=Hs(ks),a=n.data.get(s);return a===void 0&&(a=s(),n.data.set(s,a)),a},cacheSignal:function(){return Hs(ks).controller.signal}},KE=typeof WeakMap=="function"?WeakMap:Map,Ot=0,Xt=null,gt=null,bt=0,Ht=0,Ci=null,lr=!1,Ia=!1,ep=!1,Nn=0,gs=0,cr=0,Ur=0,tp=0,Ei=0,Pa=0,al=null,fi=null,sp=!1,Kc=0,K0=0,Yc=1/0,Xc=null,ur=null,Ds=0,dr=null,Ba=null,Mn=0,ip=0,np=null,Y0=null,ol=0,rp=null;function ki(){return(Ot&2)!==0&&bt!==0?bt&-bt:W.T!==null?dp():Di()}function X0(){if(Ei===0)if((bt&536870912)===0||kt){var s=ei;ei<<=1,(ei&3932160)===0&&(ei=262144),Ei=s}else Ei=536870912;return s=wi.current,s!==null&&(s.flags|=32),Ei}function pi(s,n,a){(s===Xt&&(Ht===2||Ht===9)||s.cancelPendingCommit!==null)&&(Ha(s,0),hr(s,bt,Ei,!1)),Ae(s,a),((Ot&2)===0||s!==Xt)&&(s===Xt&&((Ot&2)===0&&(Ur|=a),gs===4&&hr(s,bt,Ei,!1)),ln(s))}function J0(s,n,a){if((Ot&6)!==0)throw Error(r(327));var u=!a&&(n&127)===0&&(n&s.expiredLanes)===0||ds(s,n),E=u?JE(s,n):op(s,n,!0),T=u;do{if(E===0){Ia&&!u&&hr(s,n,0,!1);break}else{if(a=s.current.alternate,T&&!YE(a)){E=op(s,n,!1),T=!1;continue}if(E===2){if(T=n,s.errorRecoveryDisabledLanes&T)var $=0;else $=s.pendingLanes&-536870913,$=$!==0?$:$&536870912?536870912:0;if($!==0){n=$;e:{var K=s;E=al;var ne=K.current.memoizedState.isDehydrated;if(ne&&(Ha(K,$).flags|=256),$=op(K,$,!1),$!==2){if(ep&&!ne){K.errorRecoveryDisabledLanes|=T,Ur|=T,E=4;break e}T=fi,fi=E,T!==null&&(fi===null?fi=T:fi.push.apply(fi,T))}E=$}if(T=!1,E!==2)continue}}if(E===1){Ha(s,0),hr(s,n,0,!0);break}e:{switch(u=s,T=E,T){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n)break;case 6:hr(u,n,Ei,!lr);break e;case 2:fi=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(E=Kc+300-Je(),10<E)){if(hr(u,n,Ei,!lr),gi(u,0,!0)!==0)break e;Mn=n,u.timeoutHandle=jy(Z0.bind(null,u,a,fi,Xc,sp,n,Ei,Ur,Pa,lr,T,"Throttled",-0,0),E);break e}Z0(u,a,fi,Xc,sp,n,Ei,Ur,Pa,lr,T,null,-0,0)}}break}while(!0);ln(s)}function Z0(s,n,a,u,E,T,$,K,ne,pe,we,ke,ge,be){if(s.timeoutHandle=-1,ke=n.subtreeFlags,ke&8192||(ke&16785408)===16785408){ke={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Oi},F0(n,T,ke);var Ue=(T&62914560)===T?Kc-Je():(T&4194048)===T?K0-Je():0;if(Ue=Dk(ke,Ue),Ue!==null){Mn=T,s.cancelPendingCommit=Ue(ay.bind(null,s,n,T,a,u,E,$,K,ne,we,ke,null,ge,be)),hr(s,T,$,!pe);return}}ay(s,n,T,a,u,E,$,K,ne)}function YE(s){for(var n=s;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var u=0;u<a.length;u++){var E=a[u],T=E.getSnapshot;E=E.value;try{if(!bi(T(),E))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===s)break;for(;n.sibling===null;){if(n.return===null||n.return===s)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function hr(s,n,a,u){n&=~tp,n&=~Ur,s.suspendedLanes|=n,s.pingedLanes&=~n,u&&(s.warmLanes|=n),u=s.expirationTimes;for(var E=n;0<E;){var T=31-fs(E),$=1<<T;u[T]=-1,E&=~$}a!==0&&Qe(s,a,n)}function Jc(){return(Ot&6)===0?(ll(0),!1):!0}function ap(){if(gt!==null){if(Ht===0)var s=gt.return;else s=gt,Sn=Dr=null,wf(s),Ta=null,Fo=0,s=gt;for(;s!==null;)R0(s.alternate,s),s=s.return;gt=null}}function Ha(s,n){var a=s.timeoutHandle;a!==-1&&(s.timeoutHandle=-1,mk(a)),a=s.cancelPendingCommit,a!==null&&(s.cancelPendingCommit=null,a()),Mn=0,ap(),Xt=s,gt=a=yn(s.current,null),bt=n,Ht=0,Ci=null,lr=!1,Ia=ds(s,n),ep=!1,Pa=Ei=tp=Ur=cr=gs=0,fi=al=null,sp=!1,(n&8)!==0&&(n|=n&32);var u=s.entangledLanes;if(u!==0)for(s=s.entanglements,u&=n;0<u;){var E=31-fs(u),T=1<<E;n|=s[E],u&=~T}return Nn=n,_c(),a}function Q0(s,n){ut=null,W.H=Zo,n===Ra||n===kc?(n=m_(),Ht=3):n===uf?(n=m_(),Ht=4):Ht=n===Pf?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Ci=n,gt===null&&(gs=1,Hc(s,Li(n,s.current)))}function ey(){var s=wi.current;return s===null?!0:(bt&4194048)===bt?Hi===null:(bt&62914560)===bt||(bt&536870912)!==0?s===Hi:!1}function ty(){var s=W.H;return W.H=Zo,s===null?Zo:s}function sy(){var s=W.A;return W.A=GE,s}function Zc(){gs=4,lr||(bt&4194048)!==bt&&wi.current!==null||(Ia=!0),(cr&134217727)===0&&(Ur&134217727)===0||Xt===null||hr(Xt,bt,Ei,!1)}function op(s,n,a){var u=Ot;Ot|=2;var E=ty(),T=sy();(Xt!==s||bt!==n)&&(Xc=null,Ha(s,n)),n=!1;var $=gs;e:do try{if(Ht!==0&&gt!==null){var K=gt,ne=Ci;switch(Ht){case 8:ap(),$=6;break e;case 3:case 2:case 9:case 6:wi.current===null&&(n=!0);var pe=Ht;if(Ht=0,Ci=null,za(s,K,ne,pe),a&&Ia){$=0;break e}break;default:pe=Ht,Ht=0,Ci=null,za(s,K,ne,pe)}}XE(),$=gs;break}catch(we){Q0(s,we)}while(!0);return n&&s.shellSuspendCounter++,Sn=Dr=null,Ot=u,W.H=E,W.A=T,gt===null&&(Xt=null,bt=0,_c()),$}function XE(){for(;gt!==null;)iy(gt)}function JE(s,n){var a=Ot;Ot|=2;var u=ty(),E=sy();Xt!==s||bt!==n?(Xc=null,Yc=Je()+500,Ha(s,n)):Ia=ds(s,n);e:do try{if(Ht!==0&&gt!==null){n=gt;var T=Ci;t:switch(Ht){case 1:Ht=0,Ci=null,za(s,n,T,1);break;case 2:case 9:if(f_(T)){Ht=0,Ci=null,ny(n);break}n=function(){Ht!==2&&Ht!==9||Xt!==s||(Ht=7),ln(s)},T.then(n,n);break e;case 3:Ht=7;break e;case 4:Ht=5;break e;case 7:f_(T)?(Ht=0,Ci=null,ny(n)):(Ht=0,Ci=null,za(s,n,T,7));break;case 5:var $=null;switch(gt.tag){case 26:$=gt.memoizedState;case 5:case 27:var K=gt;if($?qy($):K.stateNode.complete){Ht=0,Ci=null;var ne=K.sibling;if(ne!==null)gt=ne;else{var pe=K.return;pe!==null?(gt=pe,Qc(pe)):gt=null}break t}}Ht=0,Ci=null,za(s,n,T,5);break;case 6:Ht=0,Ci=null,za(s,n,T,6);break;case 8:ap(),gs=6;break e;default:throw Error(r(462))}}ZE();break}catch(we){Q0(s,we)}while(!0);return Sn=Dr=null,W.H=u,W.A=E,Ot=a,gt!==null?0:(Xt=null,bt=0,_c(),gs)}function ZE(){for(;gt!==null&&!it();)iy(gt)}function iy(s){var n=A0(s.alternate,s,Nn);s.memoizedProps=s.pendingProps,n===null?Qc(s):gt=n}function ny(s){var n=s,a=n.alternate;switch(n.tag){case 15:case 0:n=S0(a,n,n.pendingProps,n.type,void 0,bt);break;case 11:n=S0(a,n,n.pendingProps,n.type.render,n.ref,bt);break;case 5:wf(n);default:R0(a,n),n=gt=s_(n,Nn),n=A0(a,n,Nn)}s.memoizedProps=s.pendingProps,n===null?Qc(s):gt=n}function za(s,n,a,u){Sn=Dr=null,wf(n),Ta=null,Fo=0;var E=n.return;try{if(HE(s,E,n,a,bt)){gs=1,Hc(s,Li(a,s.current)),gt=null;return}}catch(T){if(E!==null)throw gt=E,T;gs=1,Hc(s,Li(a,s.current)),gt=null;return}n.flags&32768?(kt||u===1?s=!0:Ia||(bt&536870912)!==0?s=!1:(lr=s=!0,(u===2||u===9||u===3||u===6)&&(u=wi.current,u!==null&&u.tag===13&&(u.flags|=16384))),ry(n,s)):Qc(n)}function Qc(s){var n=s;do{if((n.flags&32768)!==0){ry(n,lr);return}s=n.return;var a=qE(n.alternate,n,Nn);if(a!==null){gt=a;return}if(n=n.sibling,n!==null){gt=n;return}gt=n=s}while(n!==null);gs===0&&(gs=5)}function ry(s,n){do{var a=FE(s.alternate,s);if(a!==null){a.flags&=32767,gt=a;return}if(a=s.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(s=s.sibling,s!==null)){gt=s;return}gt=s=a}while(s!==null);gs=6,gt=null}function ay(s,n,a,u,E,T,$,K,ne){s.cancelPendingCommit=null;do eu();while(Ds!==0);if((Ot&6)!==0)throw Error(r(327));if(n!==null){if(n===s.current)throw Error(r(177));if(T=n.lanes|n.childLanes,T|=Kh,Pe(s,a,T,$,K,ne),s===Xt&&(gt=Xt=null,bt=0),Ba=n,dr=s,Mn=a,ip=T,np=E,Y0=u,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,sk(Mt,function(){return dy(),null})):(s.callbackNode=null,s.callbackPriority=0),u=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||u){u=W.T,W.T=null,E=Q.p,Q.p=2,$=Ot,Ot|=4;try{VE(s,n,a)}finally{Ot=$,Q.p=E,W.T=u}}Ds=1,oy(),ly(),cy()}}function oy(){if(Ds===1){Ds=0;var s=dr,n=Ba,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=W.T,W.T=null;var u=Q.p;Q.p=2;var E=Ot;Ot|=4;try{z0(n,s);var T=yp,$=Gg(s.containerInfo),K=T.focusedElem,ne=T.selectionRange;if($!==K&&K&&K.ownerDocument&&Wg(K.ownerDocument.documentElement,K)){if(ne!==null&&qh(K)){var pe=ne.start,we=ne.end;if(we===void 0&&(we=pe),"selectionStart"in K)K.selectionStart=pe,K.selectionEnd=Math.min(we,K.value.length);else{var ke=K.ownerDocument||document,ge=ke&&ke.defaultView||window;if(ge.getSelection){var be=ge.getSelection(),Ue=K.textContent.length,tt=Math.min(ne.start,Ue),Gt=ne.end===void 0?tt:Math.min(ne.end,Ue);!be.extend&&tt>Gt&&($=Gt,Gt=tt,tt=$);var ce=Vg(K,tt),re=Vg(K,Gt);if(ce&&re&&(be.rangeCount!==1||be.anchorNode!==ce.node||be.anchorOffset!==ce.offset||be.focusNode!==re.node||be.focusOffset!==re.offset)){var he=ke.createRange();he.setStart(ce.node,ce.offset),be.removeAllRanges(),tt>Gt?(be.addRange(he),be.extend(re.node,re.offset)):(he.setEnd(re.node,re.offset),be.addRange(he))}}}}for(ke=[],be=K;be=be.parentNode;)be.nodeType===1&&ke.push({element:be,left:be.scrollLeft,top:be.scrollTop});for(typeof K.focus=="function"&&K.focus(),K=0;K<ke.length;K++){var Ce=ke[K];Ce.element.scrollLeft=Ce.left,Ce.element.scrollTop=Ce.top}}hu=!!_p,yp=_p=null}finally{Ot=E,Q.p=u,W.T=a}}s.current=n,Ds=2}}function ly(){if(Ds===2){Ds=0;var s=dr,n=Ba,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=W.T,W.T=null;var u=Q.p;Q.p=2;var E=Ot;Ot|=4;try{L0(s,n.alternate,n)}finally{Ot=E,Q.p=u,W.T=a}}Ds=3}}function cy(){if(Ds===4||Ds===3){Ds=0,Ze();var s=dr,n=Ba,a=Mn,u=Y0;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Ds=5:(Ds=0,Ba=dr=null,uy(s,s.pendingLanes));var E=s.pendingLanes;if(E===0&&(ur=null),sn(a),n=n.stateNode,Lt&&typeof Lt.onCommitFiberRoot=="function")try{Lt.onCommitFiberRoot(xs,n,void 0,(n.current.flags&128)===128)}catch{}if(u!==null){n=W.T,E=Q.p,Q.p=2,W.T=null;try{for(var T=s.onRecoverableError,$=0;$<u.length;$++){var K=u[$];T(K.value,{componentStack:K.stack})}}finally{W.T=n,Q.p=E}}(Mn&3)!==0&&eu(),ln(s),E=s.pendingLanes,(a&261930)!==0&&(E&42)!==0?s===rp?ol++:(ol=0,rp=s):ol=0,ll(0)}}function uy(s,n){(s.pooledCacheLanes&=n)===0&&(n=s.pooledCache,n!=null&&(s.pooledCache=null,Uo(n)))}function eu(){return oy(),ly(),cy(),dy()}function dy(){if(Ds!==5)return!1;var s=dr,n=ip;ip=0;var a=sn(Mn),u=W.T,E=Q.p;try{Q.p=32>a?32:a,W.T=null,a=np,np=null;var T=dr,$=Mn;if(Ds=0,Ba=dr=null,Mn=0,(Ot&6)!==0)throw Error(r(331));var K=Ot;if(Ot|=4,W0(T.current),q0(T,T.current,$,a),Ot=K,ll(0,!1),Lt&&typeof Lt.onPostCommitFiberRoot=="function")try{Lt.onPostCommitFiberRoot(xs,T)}catch{}return!0}finally{Q.p=E,W.T=u,uy(s,n)}}function hy(s,n,a){n=Li(a,n),n=If(s.stateNode,n,2),s=nr(s,n,2),s!==null&&(Ae(s,2),ln(s))}function zt(s,n,a){if(s.tag===3)hy(s,s,a);else for(;n!==null;){if(n.tag===3){hy(n,s,a);break}else if(n.tag===1){var u=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(ur===null||!ur.has(u))){s=Li(a,s),a=f0(2),u=nr(n,a,2),u!==null&&(p0(a,u,n,s),Ae(u,2),ln(u));break}}n=n.return}}function lp(s,n,a){var u=s.pingCache;if(u===null){u=s.pingCache=new KE;var E=new Set;u.set(n,E)}else E=u.get(n),E===void 0&&(E=new Set,u.set(n,E));E.has(a)||(ep=!0,E.add(a),s=QE.bind(null,s,n,a),n.then(s,s))}function QE(s,n,a){var u=s.pingCache;u!==null&&u.delete(n),s.pingedLanes|=s.suspendedLanes&a,s.warmLanes&=~a,Xt===s&&(bt&a)===a&&(gs===4||gs===3&&(bt&62914560)===bt&&300>Je()-Kc?(Ot&2)===0&&Ha(s,0):tp|=a,Pa===bt&&(Pa=0)),ln(s)}function fy(s,n){n===0&&(n=_i()),s=Tr(s,n),s!==null&&(Ae(s,n),ln(s))}function ek(s){var n=s.memoizedState,a=0;n!==null&&(a=n.retryLane),fy(s,a)}function tk(s,n){var a=0;switch(s.tag){case 31:case 13:var u=s.stateNode,E=s.memoizedState;E!==null&&(a=E.retryLane);break;case 19:u=s.stateNode;break;case 22:u=s.stateNode._retryCache;break;default:throw Error(r(314))}u!==null&&u.delete(n),fy(s,a)}function sk(s,n){return qe(s,n)}var tu=null,Ua=null,cp=!1,su=!1,up=!1,fr=0;function ln(s){s!==Ua&&s.next===null&&(Ua===null?tu=Ua=s:Ua=Ua.next=s),su=!0,cp||(cp=!0,nk())}function ll(s,n){if(!up&&su){up=!0;do for(var a=!1,u=tu;u!==null;){if(s!==0){var E=u.pendingLanes;if(E===0)var T=0;else{var $=u.suspendedLanes,K=u.pingedLanes;T=(1<<31-fs(42|s)+1)-1,T&=E&~($&~K),T=T&201326741?T&201326741|1:T?T|2:0}T!==0&&(a=!0,gy(u,T))}else T=bt,T=gi(u,u===Xt?T:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(T&3)===0||ds(u,T)||(a=!0,gy(u,T));u=u.next}while(a);up=!1}}function ik(){py()}function py(){su=cp=!1;var s=0;fr!==0&&pk()&&(s=fr);for(var n=Je(),a=null,u=tu;u!==null;){var E=u.next,T=my(u,n);T===0?(u.next=null,a===null?tu=E:a.next=E,E===null&&(Ua=a)):(a=u,(s!==0||(T&3)!==0)&&(su=!0)),u=E}Ds!==0&&Ds!==5||ll(s),fr!==0&&(fr=0)}function my(s,n){for(var a=s.suspendedLanes,u=s.pingedLanes,E=s.expirationTimes,T=s.pendingLanes&-62914561;0<T;){var $=31-fs(T),K=1<<$,ne=E[$];ne===-1?((K&a)===0||(K&u)!==0)&&(E[$]=Ls(K,n)):ne<=n&&(s.expiredLanes|=K),T&=~K}if(n=Xt,a=bt,a=gi(s,s===n?a:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),u=s.callbackNode,a===0||s===n&&(Ht===2||Ht===9)||s.cancelPendingCommit!==null)return u!==null&&u!==null&&We(u),s.callbackNode=null,s.callbackPriority=0;if((a&3)===0||ds(s,a)){if(n=a&-a,n===s.callbackPriority)return n;switch(u!==null&&We(u),sn(a)){case 2:case 8:a=Qt;break;case 32:a=Mt;break;case 268435456:a=hs;break;default:a=Mt}return u=vy.bind(null,s),a=qe(a,u),s.callbackPriority=n,s.callbackNode=a,n}return u!==null&&u!==null&&We(u),s.callbackPriority=2,s.callbackNode=null,2}function vy(s,n){if(Ds!==0&&Ds!==5)return s.callbackNode=null,s.callbackPriority=0,null;var a=s.callbackNode;if(eu()&&s.callbackNode!==a)return null;var u=bt;return u=gi(s,s===Xt?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),u===0?null:(J0(s,u,n),my(s,Je()),s.callbackNode!=null&&s.callbackNode===a?vy.bind(null,s):null)}function gy(s,n){if(eu())return null;J0(s,n,!0)}function nk(){vk(function(){(Ot&6)!==0?qe(mt,ik):py()})}function dp(){if(fr===0){var s=Aa;s===0&&(s=Qs,Qs<<=1,(Qs&261888)===0&&(Qs=256)),fr=s}return fr}function _y(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Er(""+s)}function yy(s,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,s.id&&a.setAttribute("form",s.id),n.parentNode.insertBefore(a,n),s=new FormData(s),a.parentNode.removeChild(a),s}function rk(s,n,a,u,E){if(n==="submit"&&a&&a.stateNode===E){var T=_y((E[ye]||null).action),$=u.submitter;$&&(n=(n=$[ye]||null)?_y(n.formAction):$.getAttribute("formAction"),n!==null&&(T=n,$=null));var K=new pc("action","action",null,u,E);s.push({event:K,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(fr!==0){var ne=$?yy(E,$):new FormData(E);Nf(a,{pending:!0,data:ne,method:E.method,action:T},null,ne)}}else typeof T=="function"&&(K.preventDefault(),ne=$?yy(E,$):new FormData(E),Nf(a,{pending:!0,data:ne,method:E.method,action:T},T,ne))},currentTarget:E}]})}}for(var hp=0;hp<Gh.length;hp++){var fp=Gh[hp],ak=fp.toLowerCase(),ok=fp[0].toUpperCase()+fp.slice(1);Gi(ak,"on"+ok)}Gi(Xg,"onAnimationEnd"),Gi(Jg,"onAnimationIteration"),Gi(Zg,"onAnimationStart"),Gi("dblclick","onDoubleClick"),Gi("focusin","onFocus"),Gi("focusout","onBlur"),Gi(xE,"onTransitionRun"),Gi(CE,"onTransitionStart"),Gi(EE,"onTransitionCancel"),Gi(Qg,"onTransitionEnd"),et("onMouseEnter",["mouseout","mouseover"]),et("onMouseLeave",["mouseout","mouseover"]),et("onPointerEnter",["pointerout","pointerover"]),et("onPointerLeave",["pointerout","pointerover"]),ts("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ts("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ts("onBeforeInput",["compositionend","keypress","textInput","paste"]),ts("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ts("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ts("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var cl="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(" "),lk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(cl));function by(s,n){n=(n&4)!==0;for(var a=0;a<s.length;a++){var u=s[a],E=u.event;u=u.listeners;e:{var T=void 0;if(n)for(var $=u.length-1;0<=$;$--){var K=u[$],ne=K.instance,pe=K.currentTarget;if(K=K.listener,ne!==T&&E.isPropagationStopped())break e;T=K,E.currentTarget=pe;try{T(E)}catch(we){gc(we)}E.currentTarget=null,T=ne}else for($=0;$<u.length;$++){if(K=u[$],ne=K.instance,pe=K.currentTarget,K=K.listener,ne!==T&&E.isPropagationStopped())break e;T=K,E.currentTarget=pe;try{T(E)}catch(we){gc(we)}E.currentTarget=null,T=ne}}}}function _t(s,n){var a=n[Te];a===void 0&&(a=n[Te]=new Set);var u=s+"__bubble";a.has(u)||(Sy(n,s,2,!1),a.add(u))}function pp(s,n,a){var u=0;n&&(u|=4),Sy(a,s,u,n)}var iu="_reactListening"+Math.random().toString(36).slice(2);function mp(s){if(!s[iu]){s[iu]=!0,es.forEach(function(a){a!=="selectionchange"&&(lk.has(a)||pp(a,!1,s),pp(a,!0,s))});var n=s.nodeType===9?s:s.ownerDocument;n===null||n[iu]||(n[iu]=!0,pp("selectionchange",!1,n))}}function Sy(s,n,a,u){switch(Xy(n)){case 2:var E=Lk;break;case 8:E=Ik;break;default:E=Tp}a=E.bind(null,n,a,s),E=void 0,!Se||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(E=!0),u?E!==void 0?s.addEventListener(n,a,{capture:!0,passive:E}):s.addEventListener(n,a,!0):E!==void 0?s.addEventListener(n,a,{passive:E}):s.addEventListener(n,a,!1)}function vp(s,n,a,u,E){var T=u;if((n&1)===0&&(n&2)===0&&u!==null)e:for(;;){if(u===null)return;var $=u.tag;if($===3||$===4){var K=u.stateNode.containerInfo;if(K===E)break;if($===4)for($=u.return;$!==null;){var ne=$.tag;if((ne===3||ne===4)&&$.stateNode.containerInfo===E)return;$=$.return}for(;K!==null;){if($=ve(K),$===null)return;if(ne=$.tag,ne===5||ne===6||ne===26||ne===27){u=T=$;continue e}K=K.parentNode}}u=u.return}Mo(function(){var pe=T,we=va(a),ke=[];e:{var ge=e_.get(s);if(ge!==void 0){var be=pc,Ue=s;switch(s){case"keypress":if(kr(a)===0)break e;case"keydown":case"keyup":be=tE;break;case"focusin":Ue="focus",be=Ph;break;case"focusout":Ue="blur",be=Ph;break;case"beforeblur":case"afterblur":be=Ph;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":be=Rg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":be=q2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":be=nE;break;case Xg:case Jg:case Zg:be=W2;break;case Qg:be=aE;break;case"scroll":case"scrollend":be=z2;break;case"wheel":be=lE;break;case"copy":case"cut":case"paste":be=K2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":be=Ng;break;case"toggle":case"beforetoggle":be=uE}var tt=(n&4)!==0,Gt=!tt&&(s==="scroll"||s==="scrollend"),ce=tt?ge!==null?ge+"Capture":null:ge;tt=[];for(var re=pe,he;re!==null;){var Ce=re;if(he=Ce.stateNode,Ce=Ce.tag,Ce!==5&&Ce!==26&&Ce!==27||he===null||ce===null||(Ce=Jn(re,ce),Ce!=null&&tt.push(ul(re,Ce,he))),Gt)break;re=re.return}0<tt.length&&(ge=new be(ge,Ue,null,a,we),ke.push({event:ge,listeners:tt}))}}if((n&7)===0){e:{if(ge=s==="mouseover"||s==="pointerover",be=s==="mouseout"||s==="pointerout",ge&&a!==ma&&(Ue=a.relatedTarget||a.fromElement)&&(ve(Ue)||Ue[xe]))break e;if((be||ge)&&(ge=we.window===we?we:(ge=we.ownerDocument)?ge.defaultView||ge.parentWindow:window,be?(Ue=a.relatedTarget||a.toElement,be=pe,Ue=Ue?ve(Ue):null,Ue!==null&&(Gt=c(Ue),tt=Ue.tag,Ue!==Gt||tt!==5&&tt!==27&&tt!==6)&&(Ue=null)):(be=null,Ue=pe),be!==Ue)){if(tt=Rg,Ce="onMouseLeave",ce="onMouseEnter",re="mouse",(s==="pointerout"||s==="pointerover")&&(tt=Ng,Ce="onPointerLeave",ce="onPointerEnter",re="pointer"),Gt=be==null?ge:Be(be),he=Ue==null?ge:Be(Ue),ge=new tt(Ce,re+"leave",be,a,we),ge.target=Gt,ge.relatedTarget=he,Ce=null,ve(we)===pe&&(tt=new tt(ce,re+"enter",Ue,a,we),tt.target=he,tt.relatedTarget=Gt,Ce=tt),Gt=Ce,be&&Ue)t:{for(tt=ck,ce=be,re=Ue,he=0,Ce=ce;Ce;Ce=tt(Ce))he++;Ce=0;for(var Xe=re;Xe;Xe=tt(Xe))Ce++;for(;0<he-Ce;)ce=tt(ce),he--;for(;0<Ce-he;)re=tt(re),Ce--;for(;he--;){if(ce===re||re!==null&&ce===re.alternate){tt=ce;break t}ce=tt(ce),re=tt(re)}tt=null}else tt=null;be!==null&&wy(ke,ge,be,tt,!1),Ue!==null&&Gt!==null&&wy(ke,Gt,Ue,tt,!0)}}e:{if(ge=pe?Be(pe):window,be=ge.nodeName&&ge.nodeName.toLowerCase(),be==="select"||be==="input"&&ge.type==="file")var Tt=Bg;else if(Ig(ge))if(Hg)Tt=bE;else{Tt=_E;var Ve=gE}else be=ge.nodeName,!be||be.toLowerCase()!=="input"||ge.type!=="checkbox"&&ge.type!=="radio"?pe&&pa(pe.elementType)&&(Tt=Bg):Tt=yE;if(Tt&&(Tt=Tt(s,pe))){Pg(ke,Tt,a,we);break e}Ve&&Ve(s,ge,pe),s==="focusout"&&pe&&ge.type==="number"&&pe.memoizedProps.value!=null&&fa(ge,"number",ge.value)}switch(Ve=pe?Be(pe):window,s){case"focusin":(Ig(Ve)||Ve.contentEditable==="true")&&(ya=Ve,Fh=pe,Bo=null);break;case"focusout":Bo=Fh=ya=null;break;case"mousedown":Vh=!0;break;case"contextmenu":case"mouseup":case"dragend":Vh=!1,Kg(ke,a,we);break;case"selectionchange":if(wE)break;case"keydown":case"keyup":Kg(ke,a,we)}var ht;if(Hh)e:{switch(s){case"compositionstart":var St="onCompositionStart";break e;case"compositionend":St="onCompositionEnd";break e;case"compositionupdate":St="onCompositionUpdate";break e}St=void 0}else _a?$g(s,a)&&(St="onCompositionEnd"):s==="keydown"&&a.keyCode===229&&(St="onCompositionStart");St&&(Mg&&a.locale!=="ko"&&(_a||St!=="onCompositionStart"?St==="onCompositionEnd"&&_a&&(ht=Es()):(ze=we,Et="value"in ze?ze.value:ze.textContent,_a=!0)),Ve=nu(pe,St),0<Ve.length&&(St=new Tg(St,s,null,a,we),ke.push({event:St,listeners:Ve}),ht?St.data=ht:(ht=Lg(a),ht!==null&&(St.data=ht)))),(ht=hE?fE(s,a):pE(s,a))&&(St=nu(pe,"onBeforeInput"),0<St.length&&(Ve=new Tg("onBeforeInput","beforeinput",null,a,we),ke.push({event:Ve,listeners:St}),Ve.data=ht)),rk(ke,s,pe,a,we)}by(ke,n)})}function ul(s,n,a){return{instance:s,listener:n,currentTarget:a}}function nu(s,n){for(var a=n+"Capture",u=[];s!==null;){var E=s,T=E.stateNode;if(E=E.tag,E!==5&&E!==26&&E!==27||T===null||(E=Jn(s,a),E!=null&&u.unshift(ul(s,E,T)),E=Jn(s,n),E!=null&&u.push(ul(s,E,T))),s.tag===3)return u;s=s.return}return[]}function ck(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function wy(s,n,a,u,E){for(var T=n._reactName,$=[];a!==null&&a!==u;){var K=a,ne=K.alternate,pe=K.stateNode;if(K=K.tag,ne!==null&&ne===u)break;K!==5&&K!==26&&K!==27||pe===null||(ne=pe,E?(pe=Jn(a,T),pe!=null&&$.unshift(ul(a,pe,ne))):E||(pe=Jn(a,T),pe!=null&&$.push(ul(a,pe,ne)))),a=a.return}$.length!==0&&s.push({event:n,listeners:$})}var uk=/\r\n?/g,dk=/\u0000|\uFFFD/g;function xy(s){return(typeof s=="string"?s:""+s).replace(uk,`
49
+ `).replace(dk,"")}function Cy(s,n){return n=xy(n),xy(s)===n}function Wt(s,n,a,u,E,T){switch(a){case"children":typeof u=="string"?n==="body"||n==="textarea"&&u===""||vn(s,u):(typeof u=="number"||typeof u=="bigint")&&n!=="body"&&vn(s,""+u);break;case"className":ua(s,"class",u);break;case"tabIndex":ua(s,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":ua(s,a,u);break;case"style":To(s,u,T);break;case"data":if(n!=="object"){ua(s,"data",u);break}case"src":case"href":if(u===""&&(n!=="a"||a!=="href")){s.removeAttribute(a);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){s.removeAttribute(a);break}u=Er(""+u),s.setAttribute(a,u);break;case"action":case"formAction":if(typeof u=="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 T=="function"&&(a==="formAction"?(n!=="input"&&Wt(s,n,"name",E.name,E,null),Wt(s,n,"formEncType",E.formEncType,E,null),Wt(s,n,"formMethod",E.formMethod,E,null),Wt(s,n,"formTarget",E.formTarget,E,null)):(Wt(s,n,"encType",E.encType,E,null),Wt(s,n,"method",E.method,E,null),Wt(s,n,"target",E.target,E,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){s.removeAttribute(a);break}u=Er(""+u),s.setAttribute(a,u);break;case"onClick":u!=null&&(s.onclick=Oi);break;case"onScroll":u!=null&&_t("scroll",s);break;case"onScrollEnd":u!=null&&_t("scrollend",s);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(a=u.__html,a!=null){if(E.children!=null)throw Error(r(60));s.innerHTML=a}}break;case"multiple":s.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":s.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){s.removeAttribute("xlink:href");break}a=Er(""+u),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":u!=null&&typeof u!="function"&&typeof u!="symbol"?s.setAttribute(a,""+u):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":u&&typeof u!="function"&&typeof u!="symbol"?s.setAttribute(a,""):s.removeAttribute(a);break;case"capture":case"download":u===!0?s.setAttribute(a,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?s.setAttribute(a,u):s.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?s.setAttribute(a,u):s.removeAttribute(a);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?s.removeAttribute(a):s.setAttribute(a,u);break;case"popover":_t("beforetoggle",s),_t("toggle",s),pn(s,"popover",u);break;case"xlinkActuate":yi(s,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":yi(s,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":yi(s,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":yi(s,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":yi(s,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":yi(s,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":yi(s,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":yi(s,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":yi(s,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":pn(s,"is",u);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=dc.get(a)||a,pn(s,a,u))}}function gp(s,n,a,u,E,T){switch(a){case"style":To(s,u,T);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(a=u.__html,a!=null){if(E.children!=null)throw Error(r(60));s.innerHTML=a}}break;case"children":typeof u=="string"?vn(s,u):(typeof u=="number"||typeof u=="bigint")&&vn(s,""+u);break;case"onScroll":u!=null&&_t("scroll",s);break;case"onScrollEnd":u!=null&&_t("scrollend",s);break;case"onClick":u!=null&&(s.onclick=Oi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ye.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(E=a.endsWith("Capture"),n=a.slice(2,E?a.length-7:void 0),T=s[ye]||null,T=T!=null?T[a]:null,typeof T=="function"&&s.removeEventListener(n,T,E),typeof u=="function")){typeof T!="function"&&T!==null&&(a in s?s[a]=null:s.hasAttribute(a)&&s.removeAttribute(a)),s.addEventListener(n,u,E);break e}a in s?s[a]=u:u===!0?s.setAttribute(a,""):pn(s,a,u)}}}function Us(s,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":_t("error",s),_t("load",s);var u=!1,E=!1,T;for(T in a)if(a.hasOwnProperty(T)){var $=a[T];if($!=null)switch(T){case"src":u=!0;break;case"srcSet":E=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:Wt(s,n,T,$,a,null)}}E&&Wt(s,n,"srcSet",a.srcSet,a,null),u&&Wt(s,n,"src",a.src,a,null);return;case"input":_t("invalid",s);var K=T=$=E=null,ne=null,pe=null;for(u in a)if(a.hasOwnProperty(u)){var we=a[u];if(we!=null)switch(u){case"name":E=we;break;case"type":$=we;break;case"checked":ne=we;break;case"defaultChecked":pe=we;break;case"value":T=we;break;case"defaultValue":K=we;break;case"children":case"dangerouslySetInnerHTML":if(we!=null)throw Error(r(137,n));break;default:Wt(s,n,u,we,a,null)}}cc(s,T,K,ne,pe,$,E,!1);return;case"select":_t("invalid",s),u=$=T=null;for(E in a)if(a.hasOwnProperty(E)&&(K=a[E],K!=null))switch(E){case"value":T=K;break;case"defaultValue":$=K;break;case"multiple":u=K;default:Wt(s,n,E,K,a,null)}n=T,a=$,s.multiple=!!u,n!=null?mn(s,!!u,n,!1):a!=null&&mn(s,!!u,a,!0);return;case"textarea":_t("invalid",s),T=E=u=null;for($ in a)if(a.hasOwnProperty($)&&(K=a[$],K!=null))switch($){case"value":u=K;break;case"defaultValue":E=K;break;case"children":T=K;break;case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(91));break;default:Wt(s,n,$,K,a,null)}jo(s,u,E,T);return;case"option":for(ne in a)if(a.hasOwnProperty(ne)&&(u=a[ne],u!=null))switch(ne){case"selected":s.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:Wt(s,n,ne,u,a,null)}return;case"dialog":_t("beforetoggle",s),_t("toggle",s),_t("cancel",s),_t("close",s);break;case"iframe":case"object":_t("load",s);break;case"video":case"audio":for(u=0;u<cl.length;u++)_t(cl[u],s);break;case"image":_t("error",s),_t("load",s);break;case"details":_t("toggle",s);break;case"embed":case"source":case"link":_t("error",s),_t("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(pe in a)if(a.hasOwnProperty(pe)&&(u=a[pe],u!=null))switch(pe){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:Wt(s,n,pe,u,a,null)}return;default:if(pa(n)){for(we in a)a.hasOwnProperty(we)&&(u=a[we],u!==void 0&&gp(s,n,we,u,a,void 0));return}}for(K in a)a.hasOwnProperty(K)&&(u=a[K],u!=null&&Wt(s,n,K,u,a,null))}function hk(s,n,a,u){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var E=null,T=null,$=null,K=null,ne=null,pe=null,we=null;for(be in a){var ke=a[be];if(a.hasOwnProperty(be)&&ke!=null)switch(be){case"checked":break;case"value":break;case"defaultValue":ne=ke;default:u.hasOwnProperty(be)||Wt(s,n,be,null,u,ke)}}for(var ge in u){var be=u[ge];if(ke=a[ge],u.hasOwnProperty(ge)&&(be!=null||ke!=null))switch(ge){case"type":T=be;break;case"name":E=be;break;case"checked":pe=be;break;case"defaultChecked":we=be;break;case"value":$=be;break;case"defaultValue":K=be;break;case"children":case"dangerouslySetInnerHTML":if(be!=null)throw Error(r(137,n));break;default:be!==ke&&Wt(s,n,ge,be,u,ke)}}ko(s,$,K,ne,pe,we,T,E);return;case"select":be=$=K=ge=null;for(T in a)if(ne=a[T],a.hasOwnProperty(T)&&ne!=null)switch(T){case"value":break;case"multiple":be=ne;default:u.hasOwnProperty(T)||Wt(s,n,T,null,u,ne)}for(E in u)if(T=u[E],ne=a[E],u.hasOwnProperty(E)&&(T!=null||ne!=null))switch(E){case"value":ge=T;break;case"defaultValue":K=T;break;case"multiple":$=T;default:T!==ne&&Wt(s,n,E,T,u,ne)}n=K,a=$,u=be,ge!=null?mn(s,!!a,ge,!1):!!u!=!!a&&(n!=null?mn(s,!!a,n,!0):mn(s,!!a,a?[]:"",!1));return;case"textarea":be=ge=null;for(K in a)if(E=a[K],a.hasOwnProperty(K)&&E!=null&&!u.hasOwnProperty(K))switch(K){case"value":break;case"children":break;default:Wt(s,n,K,null,u,E)}for($ in u)if(E=u[$],T=a[$],u.hasOwnProperty($)&&(E!=null||T!=null))switch($){case"value":ge=E;break;case"defaultValue":be=E;break;case"children":break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(r(91));break;default:E!==T&&Wt(s,n,$,E,u,T)}Ao(s,ge,be);return;case"option":for(var Ue in a)if(ge=a[Ue],a.hasOwnProperty(Ue)&&ge!=null&&!u.hasOwnProperty(Ue))switch(Ue){case"selected":s.selected=!1;break;default:Wt(s,n,Ue,null,u,ge)}for(ne in u)if(ge=u[ne],be=a[ne],u.hasOwnProperty(ne)&&ge!==be&&(ge!=null||be!=null))switch(ne){case"selected":s.selected=ge&&typeof ge!="function"&&typeof ge!="symbol";break;default:Wt(s,n,ne,ge,u,be)}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 tt in a)ge=a[tt],a.hasOwnProperty(tt)&&ge!=null&&!u.hasOwnProperty(tt)&&Wt(s,n,tt,null,u,ge);for(pe in u)if(ge=u[pe],be=a[pe],u.hasOwnProperty(pe)&&ge!==be&&(ge!=null||be!=null))switch(pe){case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(r(137,n));break;default:Wt(s,n,pe,ge,u,be)}return;default:if(pa(n)){for(var Gt in a)ge=a[Gt],a.hasOwnProperty(Gt)&&ge!==void 0&&!u.hasOwnProperty(Gt)&&gp(s,n,Gt,void 0,u,ge);for(we in u)ge=u[we],be=a[we],!u.hasOwnProperty(we)||ge===be||ge===void 0&&be===void 0||gp(s,n,we,ge,u,be);return}}for(var ce in a)ge=a[ce],a.hasOwnProperty(ce)&&ge!=null&&!u.hasOwnProperty(ce)&&Wt(s,n,ce,null,u,ge);for(ke in u)ge=u[ke],be=a[ke],!u.hasOwnProperty(ke)||ge===be||ge==null&&be==null||Wt(s,n,ke,ge,u,be)}function Ey(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function fk(){if(typeof performance.getEntriesByType=="function"){for(var s=0,n=0,a=performance.getEntriesByType("resource"),u=0;u<a.length;u++){var E=a[u],T=E.transferSize,$=E.initiatorType,K=E.duration;if(T&&K&&Ey($)){for($=0,K=E.responseEnd,u+=1;u<a.length;u++){var ne=a[u],pe=ne.startTime;if(pe>K)break;var we=ne.transferSize,ke=ne.initiatorType;we&&Ey(ke)&&(ne=ne.responseEnd,$+=we*(ne<K?1:(K-pe)/(ne-pe)))}if(--u,n+=8*(T+$)/(E.duration/1e3),s++,10<s)break}}if(0<s)return n/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var _p=null,yp=null;function ru(s){return s.nodeType===9?s:s.ownerDocument}function ky(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 Ay(s,n){if(s===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&n==="foreignObject"?0:s}function bp(s,n){return s==="textarea"||s==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Sp=null;function pk(){var s=window.event;return s&&s.type==="popstate"?s===Sp?!1:(Sp=s,!0):(Sp=null,!1)}var jy=typeof setTimeout=="function"?setTimeout:void 0,mk=typeof clearTimeout=="function"?clearTimeout:void 0,Ry=typeof Promise=="function"?Promise:void 0,vk=typeof queueMicrotask=="function"?queueMicrotask:typeof Ry<"u"?function(s){return Ry.resolve(null).then(s).catch(gk)}:jy;function gk(s){setTimeout(function(){throw s})}function pr(s){return s==="head"}function Ty(s,n){var a=n,u=0;do{var E=a.nextSibling;if(s.removeChild(a),E&&E.nodeType===8)if(a=E.data,a==="/$"||a==="/&"){if(u===0){s.removeChild(E),Wa(n);return}u--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")u++;else if(a==="html")dl(s.ownerDocument.documentElement);else if(a==="head"){a=s.ownerDocument.head,dl(a);for(var T=a.firstChild;T;){var $=T.nextSibling,K=T.nodeName;T[Rt]||K==="SCRIPT"||K==="STYLE"||K==="LINK"&&T.rel.toLowerCase()==="stylesheet"||a.removeChild(T),T=$}}else a==="body"&&dl(s.ownerDocument.body);a=E}while(a);Wa(n)}function Ny(s,n){var a=s;s=0;do{var u=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),u&&u.nodeType===8)if(a=u.data,a==="/$"){if(s===0)break;s--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||s++;a=u}while(a)}function wp(s){var n=s.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":wp(a),Ct(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}s.removeChild(a)}}function _k(s,n,a,u){for(;s.nodeType===1;){var E=a;if(s.nodeName.toLowerCase()!==n.toLowerCase()){if(!u&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(u){if(!s[Rt])switch(n){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(T=s.getAttribute("rel"),T==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(T!==E.rel||s.getAttribute("href")!==(E.href==null||E.href===""?null:E.href)||s.getAttribute("crossorigin")!==(E.crossOrigin==null?null:E.crossOrigin)||s.getAttribute("title")!==(E.title==null?null:E.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(T=s.getAttribute("src"),(T!==(E.src==null?null:E.src)||s.getAttribute("type")!==(E.type==null?null:E.type)||s.getAttribute("crossorigin")!==(E.crossOrigin==null?null:E.crossOrigin))&&T&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(n==="input"&&s.type==="hidden"){var T=E.name==null?null:""+E.name;if(E.type==="hidden"&&s.getAttribute("name")===T)return s}else return s;if(s=zi(s.nextSibling),s===null)break}return null}function yk(s,n,a){if(n==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=zi(s.nextSibling),s===null))return null;return s}function My(s,n){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!n||(s=zi(s.nextSibling),s===null))return null;return s}function xp(s){return s.data==="$?"||s.data==="$~"}function Cp(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function bk(s,n){var a=s.ownerDocument;if(s.data==="$~")s._reactRetry=n;else if(s.data!=="$?"||a.readyState!=="loading")n();else{var u=function(){n(),a.removeEventListener("DOMContentLoaded",u)};a.addEventListener("DOMContentLoaded",u),s._reactRetry=u}}function zi(s){for(;s!=null;s=s.nextSibling){var n=s.nodeType;if(n===1||n===3)break;if(n===8){if(n=s.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return s}var Ep=null;function Dy(s){s=s.nextSibling;for(var n=0;s;){if(s.nodeType===8){var a=s.data;if(a==="/$"||a==="/&"){if(n===0)return zi(s.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}s=s.nextSibling}return null}function Oy(s){s=s.previousSibling;for(var n=0;s;){if(s.nodeType===8){var a=s.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return s;n--}else a!=="/$"&&a!=="/&"||n++}s=s.previousSibling}return null}function $y(s,n,a){switch(n=ru(a),s){case"html":if(s=n.documentElement,!s)throw Error(r(452));return s;case"head":if(s=n.head,!s)throw Error(r(453));return s;case"body":if(s=n.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function dl(s){for(var n=s.attributes;n.length;)s.removeAttributeNode(n[0]);Ct(s)}var Ui=new Map,Ly=new Set;function au(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Dn=Q.d;Q.d={f:Sk,r:wk,D:xk,C:Ck,L:Ek,m:kk,X:jk,S:Ak,M:Rk};function Sk(){var s=Dn.f(),n=Jc();return s||n}function wk(s){var n=$e(s);n!==null&&n.tag===5&&n.type==="form"?Q_(n):Dn.r(s)}var qa=typeof document>"u"?null:document;function Iy(s,n,a){var u=qa;if(u&&typeof n=="string"&&n){var E=si(n);E='link[rel="'+s+'"][href="'+E+'"]',typeof a=="string"&&(E+='[crossorigin="'+a+'"]'),Ly.has(E)||(Ly.add(E),s={rel:s,crossOrigin:a,href:n},u.querySelector(E)===null&&(n=u.createElement("link"),Us(n,"link",s),Ke(n),u.head.appendChild(n)))}}function xk(s){Dn.D(s),Iy("dns-prefetch",s,null)}function Ck(s,n){Dn.C(s,n),Iy("preconnect",s,n)}function Ek(s,n,a){Dn.L(s,n,a);var u=qa;if(u&&s&&n){var E='link[rel="preload"][as="'+si(n)+'"]';n==="image"&&a&&a.imageSrcSet?(E+='[imagesrcset="'+si(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(E+='[imagesizes="'+si(a.imageSizes)+'"]')):E+='[href="'+si(s)+'"]';var T=E;switch(n){case"style":T=Fa(s);break;case"script":T=Va(s)}Ui.has(T)||(s=v({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:s,as:n},a),Ui.set(T,s),u.querySelector(E)!==null||n==="style"&&u.querySelector(hl(T))||n==="script"&&u.querySelector(fl(T))||(n=u.createElement("link"),Us(n,"link",s),Ke(n),u.head.appendChild(n)))}}function kk(s,n){Dn.m(s,n);var a=qa;if(a&&s){var u=n&&typeof n.as=="string"?n.as:"script",E='link[rel="modulepreload"][as="'+si(u)+'"][href="'+si(s)+'"]',T=E;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":T=Va(s)}if(!Ui.has(T)&&(s=v({rel:"modulepreload",href:s},n),Ui.set(T,s),a.querySelector(E)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(fl(T)))return}u=a.createElement("link"),Us(u,"link",s),Ke(u),a.head.appendChild(u)}}}function Ak(s,n,a){Dn.S(s,n,a);var u=qa;if(u&&s){var E=Fe(u).hoistableStyles,T=Fa(s);n=n||"default";var $=E.get(T);if(!$){var K={loading:0,preload:null};if($=u.querySelector(hl(T)))K.loading=5;else{s=v({rel:"stylesheet",href:s,"data-precedence":n},a),(a=Ui.get(T))&&kp(s,a);var ne=$=u.createElement("link");Ke(ne),Us(ne,"link",s),ne._p=new Promise(function(pe,we){ne.onload=pe,ne.onerror=we}),ne.addEventListener("load",function(){K.loading|=1}),ne.addEventListener("error",function(){K.loading|=2}),K.loading|=4,ou($,n,u)}$={type:"stylesheet",instance:$,count:1,state:K},E.set(T,$)}}}function jk(s,n){Dn.X(s,n);var a=qa;if(a&&s){var u=Fe(a).hoistableScripts,E=Va(s),T=u.get(E);T||(T=a.querySelector(fl(E)),T||(s=v({src:s,async:!0},n),(n=Ui.get(E))&&Ap(s,n),T=a.createElement("script"),Ke(T),Us(T,"link",s),a.head.appendChild(T)),T={type:"script",instance:T,count:1,state:null},u.set(E,T))}}function Rk(s,n){Dn.M(s,n);var a=qa;if(a&&s){var u=Fe(a).hoistableScripts,E=Va(s),T=u.get(E);T||(T=a.querySelector(fl(E)),T||(s=v({src:s,async:!0,type:"module"},n),(n=Ui.get(E))&&Ap(s,n),T=a.createElement("script"),Ke(T),Us(T,"link",s),a.head.appendChild(T)),T={type:"script",instance:T,count:1,state:null},u.set(E,T))}}function Py(s,n,a,u){var E=(E=se.current)?au(E):null;if(!E)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=Fa(a.href),a=Fe(E).hoistableStyles,u=a.get(n),u||(u={type:"style",instance:null,count:0,state:null},a.set(n,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){s=Fa(a.href);var T=Fe(E).hoistableStyles,$=T.get(s);if($||(E=E.ownerDocument||E,$={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},T.set(s,$),(T=E.querySelector(hl(s)))&&!T._p&&($.instance=T,$.state.loading=5),Ui.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},Ui.set(s,a),T||Tk(E,s,a,$.state))),n&&u===null)throw Error(r(528,""));return $}if(n&&u!==null)throw Error(r(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Va(a),a=Fe(E).hoistableScripts,u=a.get(n),u||(u={type:"script",instance:null,count:0,state:null},a.set(n,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function Fa(s){return'href="'+si(s)+'"'}function hl(s){return'link[rel="stylesheet"]['+s+"]"}function By(s){return v({},s,{"data-precedence":s.precedence,precedence:null})}function Tk(s,n,a,u){s.querySelector('link[rel="preload"][as="style"]['+n+"]")?u.loading=1:(n=s.createElement("link"),u.preload=n,n.addEventListener("load",function(){return u.loading|=1}),n.addEventListener("error",function(){return u.loading|=2}),Us(n,"link",a),Ke(n),s.head.appendChild(n))}function Va(s){return'[src="'+si(s)+'"]'}function fl(s){return"script[async]"+s}function Hy(s,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var u=s.querySelector('style[data-href~="'+si(a.href)+'"]');if(u)return n.instance=u,Ke(u),u;var E=v({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return u=(s.ownerDocument||s).createElement("style"),Ke(u),Us(u,"style",E),ou(u,a.precedence,s),n.instance=u;case"stylesheet":E=Fa(a.href);var T=s.querySelector(hl(E));if(T)return n.state.loading|=4,n.instance=T,Ke(T),T;u=By(a),(E=Ui.get(E))&&kp(u,E),T=(s.ownerDocument||s).createElement("link"),Ke(T);var $=T;return $._p=new Promise(function(K,ne){$.onload=K,$.onerror=ne}),Us(T,"link",u),n.state.loading|=4,ou(T,a.precedence,s),n.instance=T;case"script":return T=Va(a.src),(E=s.querySelector(fl(T)))?(n.instance=E,Ke(E),E):(u=a,(E=Ui.get(T))&&(u=v({},a),Ap(u,E)),s=s.ownerDocument||s,E=s.createElement("script"),Ke(E),Us(E,"link",u),s.head.appendChild(E),n.instance=E);case"void":return null;default:throw Error(r(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(u=n.instance,n.state.loading|=4,ou(u,a.precedence,s));return n.instance}function ou(s,n,a){for(var u=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),E=u.length?u[u.length-1]:null,T=E,$=0;$<u.length;$++){var K=u[$];if(K.dataset.precedence===n)T=K;else if(T!==E)break}T?T.parentNode.insertBefore(s,T.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(s,n.firstChild))}function kp(s,n){s.crossOrigin==null&&(s.crossOrigin=n.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=n.referrerPolicy),s.title==null&&(s.title=n.title)}function Ap(s,n){s.crossOrigin==null&&(s.crossOrigin=n.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=n.referrerPolicy),s.integrity==null&&(s.integrity=n.integrity)}var lu=null;function zy(s,n,a){if(lu===null){var u=new Map,E=lu=new Map;E.set(a,u)}else E=lu,u=E.get(a),u||(u=new Map,E.set(a,u));if(u.has(s))return u;for(u.set(s,null),a=a.getElementsByTagName(s),E=0;E<a.length;E++){var T=a[E];if(!(T[Rt]||T[fe]||s==="link"&&T.getAttribute("rel")==="stylesheet")&&T.namespaceURI!=="http://www.w3.org/2000/svg"){var $=T.getAttribute(n)||"";$=s+$;var K=u.get($);K?K.push(T):u.set($,[T])}}return u}function Uy(s,n,a){s=s.ownerDocument||s,s.head.insertBefore(a,n==="title"?s.querySelector("head > title"):null)}function Nk(s,n,a){if(a===1||n.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return s=n.disabled,typeof n.precedence=="string"&&s==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function qy(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Mk(s,n,a,u){if(a.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var E=Fa(u.href),T=n.querySelector(hl(E));if(T){n=T._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(s.count++,s=cu.bind(s),n.then(s,s)),a.state.loading|=4,a.instance=T,Ke(T);return}T=n.ownerDocument||n,u=By(u),(E=Ui.get(E))&&kp(u,E),T=T.createElement("link"),Ke(T);var $=T;$._p=new Promise(function(K,ne){$.onload=K,$.onerror=ne}),Us(T,"link",u),a.instance=T}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(s.count++,a=cu.bind(s),n.addEventListener("load",a),n.addEventListener("error",a))}}var jp=0;function Dk(s,n){return s.stylesheets&&s.count===0&&du(s,s.stylesheets),0<s.count||0<s.imgCount?function(a){var u=setTimeout(function(){if(s.stylesheets&&du(s,s.stylesheets),s.unsuspend){var T=s.unsuspend;s.unsuspend=null,T()}},6e4+n);0<s.imgBytes&&jp===0&&(jp=62500*fk());var E=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&du(s,s.stylesheets),s.unsuspend)){var T=s.unsuspend;s.unsuspend=null,T()}},(s.imgBytes>jp?50:800)+n);return s.unsuspend=a,function(){s.unsuspend=null,clearTimeout(u),clearTimeout(E)}}:null}function cu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)du(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var uu=null;function du(s,n){s.stylesheets=null,s.unsuspend!==null&&(s.count++,uu=new Map,n.forEach(Ok,s),uu=null,cu.call(s))}function Ok(s,n){if(!(n.state.loading&4)){var a=uu.get(s);if(a)var u=a.get(null);else{a=new Map,uu.set(s,a);for(var E=s.querySelectorAll("link[data-precedence],style[data-precedence]"),T=0;T<E.length;T++){var $=E[T];($.nodeName==="LINK"||$.getAttribute("media")!=="not all")&&(a.set($.dataset.precedence,$),u=$)}u&&a.set(null,u)}E=n.instance,$=E.getAttribute("data-precedence"),T=a.get($)||u,T===u&&a.set(null,E),a.set($,E),this.count++,u=cu.bind(this),E.addEventListener("load",u),E.addEventListener("error",u),T?T.parentNode.insertBefore(E,T.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(E,s.firstChild)),n.state.loading|=4}}var pl={$$typeof:_,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function $k(s,n,a,u,E,T,$,K,ne){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=ys(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ys(0),this.hiddenUpdates=ys(null),this.identifierPrefix=u,this.onUncaughtError=E,this.onCaughtError=T,this.onRecoverableError=$,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ne,this.incompleteTransitions=new Map}function Fy(s,n,a,u,E,T,$,K,ne,pe,we,ke){return s=new $k(s,n,a,$,ne,pe,we,ke,K),n=1,T===!0&&(n|=24),T=Si(3,null,null,n),s.current=T,T.stateNode=s,n=of(),n.refCount++,s.pooledCache=n,n.refCount++,T.memoizedState={element:u,isDehydrated:a,cache:n},df(T),s}function Vy(s){return s?(s=wa,s):wa}function Wy(s,n,a,u,E,T){E=Vy(E),u.context===null?u.context=E:u.pendingContext=E,u=ir(n),u.payload={element:a},T=T===void 0?null:T,T!==null&&(u.callback=T),a=nr(s,u,n),a!==null&&(pi(a,s,n),Wo(a,s,n))}function Gy(s,n){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var a=s.retryLane;s.retryLane=a!==0&&a<n?a:n}}function Rp(s,n){Gy(s,n),(s=s.alternate)&&Gy(s,n)}function Ky(s){if(s.tag===13||s.tag===31){var n=Tr(s,67108864);n!==null&&pi(n,s,67108864),Rp(s,67108864)}}function Yy(s){if(s.tag===13||s.tag===31){var n=ki();n=Cs(n);var a=Tr(s,n);a!==null&&pi(a,s,n),Rp(s,n)}}var hu=!0;function Lk(s,n,a,u){var E=W.T;W.T=null;var T=Q.p;try{Q.p=2,Tp(s,n,a,u)}finally{Q.p=T,W.T=E}}function Ik(s,n,a,u){var E=W.T;W.T=null;var T=Q.p;try{Q.p=8,Tp(s,n,a,u)}finally{Q.p=T,W.T=E}}function Tp(s,n,a,u){if(hu){var E=Np(u);if(E===null)vp(s,n,u,fu,a),Jy(s,u);else if(Bk(E,s,n,a,u))u.stopPropagation();else if(Jy(s,u),n&4&&-1<Pk.indexOf(s)){for(;E!==null;){var T=$e(E);if(T!==null)switch(T.tag){case 3:if(T=T.stateNode,T.current.memoizedState.isDehydrated){var $=$s(T.pendingLanes);if($!==0){var K=T;for(K.pendingLanes|=2,K.entangledLanes|=2;$;){var ne=1<<31-fs($);K.entanglements[1]|=ne,$&=~ne}ln(T),(Ot&6)===0&&(Yc=Je()+500,ll(0))}}break;case 31:case 13:K=Tr(T,2),K!==null&&pi(K,T,2),Jc(),Rp(T,2)}if(T=Np(u),T===null&&vp(s,n,u,fu,a),T===E)break;E=T}E!==null&&u.stopPropagation()}else vp(s,n,u,null,a)}}function Np(s){return s=va(s),Mp(s)}var fu=null;function Mp(s){if(fu=null,s=ve(s),s!==null){var n=c(s);if(n===null)s=null;else{var a=n.tag;if(a===13){if(s=f(n),s!==null)return s;s=null}else if(a===31){if(s=l(n),s!==null)return s;s=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;s=null}else n!==s&&(s=null)}}return fu=s,null}function Xy(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 Qt:return 8;case Mt:case At:return 32;case hs:return 268435456;default:return 32}default:return 32}}var Dp=!1,mr=null,vr=null,gr=null,ml=new Map,vl=new Map,_r=[],Pk="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 Jy(s,n){switch(s){case"focusin":case"focusout":mr=null;break;case"dragenter":case"dragleave":vr=null;break;case"mouseover":case"mouseout":gr=null;break;case"pointerover":case"pointerout":ml.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":vl.delete(n.pointerId)}}function gl(s,n,a,u,E,T){return s===null||s.nativeEvent!==T?(s={blockedOn:n,domEventName:a,eventSystemFlags:u,nativeEvent:T,targetContainers:[E]},n!==null&&(n=$e(n),n!==null&&Ky(n)),s):(s.eventSystemFlags|=u,n=s.targetContainers,E!==null&&n.indexOf(E)===-1&&n.push(E),s)}function Bk(s,n,a,u,E){switch(n){case"focusin":return mr=gl(mr,s,n,a,u,E),!0;case"dragenter":return vr=gl(vr,s,n,a,u,E),!0;case"mouseover":return gr=gl(gr,s,n,a,u,E),!0;case"pointerover":var T=E.pointerId;return ml.set(T,gl(ml.get(T)||null,s,n,a,u,E)),!0;case"gotpointercapture":return T=E.pointerId,vl.set(T,gl(vl.get(T)||null,s,n,a,u,E)),!0}return!1}function Zy(s){var n=ve(s.target);if(n!==null){var a=c(n);if(a!==null){if(n=a.tag,n===13){if(n=f(a),n!==null){s.blockedOn=n,li(s.priority,function(){Yy(a)});return}}else if(n===31){if(n=l(a),n!==null){s.blockedOn=n,li(s.priority,function(){Yy(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){s.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}s.blockedOn=null}function pu(s){if(s.blockedOn!==null)return!1;for(var n=s.targetContainers;0<n.length;){var a=Np(s.nativeEvent);if(a===null){a=s.nativeEvent;var u=new a.constructor(a.type,a);ma=u,a.target.dispatchEvent(u),ma=null}else return n=$e(a),n!==null&&Ky(n),s.blockedOn=a,!1;n.shift()}return!0}function Qy(s,n,a){pu(s)&&a.delete(n)}function Hk(){Dp=!1,mr!==null&&pu(mr)&&(mr=null),vr!==null&&pu(vr)&&(vr=null),gr!==null&&pu(gr)&&(gr=null),ml.forEach(Qy),vl.forEach(Qy)}function mu(s,n){s.blockedOn===n&&(s.blockedOn=null,Dp||(Dp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Hk)))}var vu=null;function eb(s){vu!==s&&(vu=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){vu===s&&(vu=null);for(var n=0;n<s.length;n+=3){var a=s[n],u=s[n+1],E=s[n+2];if(typeof u!="function"){if(Mp(u||a)===null)continue;break}var T=$e(a);T!==null&&(s.splice(n,3),n-=3,Nf(T,{pending:!0,data:E,method:a.method,action:u},u,E))}}))}function Wa(s){function n(ne){return mu(ne,s)}mr!==null&&mu(mr,s),vr!==null&&mu(vr,s),gr!==null&&mu(gr,s),ml.forEach(n),vl.forEach(n);for(var a=0;a<_r.length;a++){var u=_r[a];u.blockedOn===s&&(u.blockedOn=null)}for(;0<_r.length&&(a=_r[0],a.blockedOn===null);)Zy(a),a.blockedOn===null&&_r.shift();if(a=(s.ownerDocument||s).$$reactFormReplay,a!=null)for(u=0;u<a.length;u+=3){var E=a[u],T=a[u+1],$=E[ye]||null;if(typeof T=="function")$||eb(a);else if($){var K=null;if(T&&T.hasAttribute("formAction")){if(E=T,$=T[ye]||null)K=$.formAction;else if(Mp(E)!==null)continue}else K=$.action;typeof K=="function"?a[u+1]=K:(a.splice(u,3),u-=3),eb(a)}}}function tb(){function s(T){T.canIntercept&&T.info==="react-transition"&&T.intercept({handler:function(){return new Promise(function($){return E=$})},focusReset:"manual",scroll:"manual"})}function n(){E!==null&&(E(),E=null),u||setTimeout(a,20)}function a(){if(!u&&!navigation.transition){var T=navigation.currentEntry;T&&T.url!=null&&navigation.navigate(T.url,{state:T.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,E=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){u=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),E!==null&&(E(),E=null)}}}function Op(s){this._internalRoot=s}gu.prototype.render=Op.prototype.render=function(s){var n=this._internalRoot;if(n===null)throw Error(r(409));var a=n.current,u=ki();Wy(a,u,s,n,null,null)},gu.prototype.unmount=Op.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var n=s.containerInfo;Wy(s.current,2,null,s,null,null),Jc(),n[xe]=null}};function gu(s){this._internalRoot=s}gu.prototype.unstable_scheduleHydration=function(s){if(s){var n=Di();s={blockedOn:null,target:s,priority:n};for(var a=0;a<_r.length&&n!==0&&n<_r[a].priority;a++);_r.splice(a,0,s),a===0&&Zy(s)}};var sb=t.version;if(sb!=="19.2.7")throw Error(r(527,sb,"19.2.7"));Q.findDOMNode=function(s){var n=s._reactInternals;if(n===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=m(n),s=s!==null?y(s):null,s=s===null?null:s.stateNode,s};var zk={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:W,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var _u=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_u.isDisabled&&_u.supportsFiber)try{xs=_u.inject(zk),Lt=_u}catch{}}return yl.createRoot=function(s,n){if(!o(s))throw Error(r(299));var a=!1,u="",E=c0,T=u0,$=d0;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(u=n.identifierPrefix),n.onUncaughtError!==void 0&&(E=n.onUncaughtError),n.onCaughtError!==void 0&&(T=n.onCaughtError),n.onRecoverableError!==void 0&&($=n.onRecoverableError)),n=Fy(s,1,!1,null,null,a,u,null,E,T,$,tb),s[xe]=n.current,mp(s),new Op(n)},yl.hydrateRoot=function(s,n,a){if(!o(s))throw Error(r(299));var u=!1,E="",T=c0,$=u0,K=d0,ne=null;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(E=a.identifierPrefix),a.onUncaughtError!==void 0&&(T=a.onUncaughtError),a.onCaughtError!==void 0&&($=a.onCaughtError),a.onRecoverableError!==void 0&&(K=a.onRecoverableError),a.formState!==void 0&&(ne=a.formState)),n=Fy(s,1,!0,n,a??null,u,E,ne,T,$,K,tb),n.context=Vy(null),a=n.current,u=ki(),u=Cs(u),E=ir(u),E.callback=null,nr(a,E,u),a=u,n.current.lanes=a,Ae(n,a),ln(n),s[xe]=n.current,mp(s),new gu(n)},yl.version="19.2.7",yl}var hb;function Qk(){if(hb)return Pp.exports;hb=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(),Pp.exports=Zk(),Pp.exports}var eA=Qk();const Vw="sapiom-harness-theme",qm=new Set;function tA(){var e;return typeof window<"u"&&((e=window.matchMedia)==null?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)===!0}function sA(){const e=typeof window<"u"?window.localStorage.getItem(Vw):null;return e==="light"||e==="dark"?e:tA()?"dark":"light"}let Fv=sA();function bh(){return Fv}function iA(e){Fv=e,document.documentElement.dataset.theme=e,window.localStorage.setItem(Vw,e),qm.forEach(t=>t(e))}function Ww(){iA(Fv==="dark"?"light":"dark")}function Vv(e){return qm.add(e),()=>qm.delete(e)}const Gw=Date.now(),Vs=e=>new Date(Gw-e*6e4).toISOString(),nt=e=>new Date(Gw-e*24*60*6e4).toISOString(),fb="/Users/demo/acme-app";Vs(1),Vs(1),Vs(42),Vs(20),nt(2),nt(1),nt(1),nt(1),nt(3),nt(3),Vs(0),Vs(0),Vs(3),Vs(3);Vs(1),nt(1),nt(1),nt(3),nt(6),nt(45),nt(1);Vs(48),Vs(1),Vs(48),Vs(47),Vs(46),Vs(45),Vs(3),Vs(2),nt(1),nt(1),nt(1),nt(1),nt(1),nt(1),nt(1),nt(1),nt(1),nt(3),nt(3),nt(3),nt(3),nt(3),nt(3),nt(3),nt(3),nt(1),nt(1),nt(1),nt(1),nt(45),nt(45),nt(45),nt(45),nt(45),nt(45),nt(45),nt(45);[...[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:nt(e),source:"transcript",resumeMode:"rehydrate",turnCount:6-t})),nt(3),nt(1),nt(6)];function Wv(){return!1}function ra(e){return(e==null?void 0:e.boundWorkflowPath)??null}class ji extends Error{constructor(i,r,o){super(r);$p(this,"status");$p(this,"reason");this.name="ApiError",this.status=i,this.reason=o}}function co(){const e=window.__HARNESS__;return e!=null&&e.token?e.token:new URLSearchParams(window.location.search).get("token")??""}class nA{startAuth(){return this.request("/api/auth/start",{method:"POST"})}disconnect(){return this.request("/api/auth/disconnect",{method:"POST"})}authStatus(){return this.request("/api/auth/status")}async request(t,i){const r=await fetch(t,{...i,headers:{"Content-Type":"application/json","X-Harness-Token":co(),...i==null?void 0:i.headers}});if(!r.ok){const o=await r.text().catch(()=>"");let c;try{const f=o?JSON.parse(o):void 0;f&&typeof f=="object"&&typeof f.error=="string"&&(c=f.error)}catch{}throw new ji(r.status,`${(i==null?void 0:i.method)??"GET"} ${t} → ${r.status}${o?`: ${o}`:""}`,c)}if(r.status!==204)return await r.json()}getState(){return this.request("/api/state")}createSession(t){return this.request("/api/sessions",{method:"POST",body:JSON.stringify({theme:bh(),...t})})}attachFile(t,i){return this.request(`/api/sessions/${encodeURIComponent(t)}/attachments`,{method:"POST",body:JSON.stringify(i)})}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(i){if(i instanceof ji&&(i.status===404||i.status===501))return null;throw i}}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,i){await this.request(`/api/sessions/${encodeURIComponent(t)}/input`,{method:"POST",body:JSON.stringify(i)})}listWorkflows(){return this.request("/api/workflows")}getWorkflowInputContract(t){return this.request(`/api/workflows/${encodeURIComponent(t)}/input-contract`)}connectWorkflow(t){return this.request("/api/workflows/connect",{method:"POST",body:JSON.stringify({path:t})})}scanWorkflows(t){return this.request("/api/workflows/scan",{method:"POST",body:JSON.stringify({root:t})})}listHarnesses(){return this.request("/api/harnesses")}listMacros(){return this.request("/api/macros")}async runMacro(t,i){await this.request(`/api/macros/${encodeURIComponent(t)}/run`,{method:"POST",body:JSON.stringify(i)})}getSettings(){return this.request("/api/settings")}updateSettings(t){return this.request("/api/settings",{method:"PATCH",body:JSON.stringify(t)})}listDir(t){const i=t?`?path=${encodeURIComponent(t)}`:"";return this.request(`/api/fs/list${i}`)}bindWorkflow(t,i){const r={workflowPath:i};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,i){const r=await fetch("/api/runs/local",{method:"POST",headers:{"Content-Type":"application/json","X-Harness-Token":co()},body:JSON.stringify(t)});if(!r.ok||!r.body){const d=await r.text().catch(()=>"");throw new ji(r.status,`POST /api/runs/local → ${r.status}${d?`: ${d}`:""}`,void 0)}const o=r.body.getReader(),c=new TextDecoder;let f="";const l=(d,m)=>{f+=d;const{lines:y,rest:v}=aA(f,m);f=v;for(const S of y){const w=oA(S);w&&i(w)}};for(;;){const{done:d,value:m}=await o.read();if(d)break;l(c.decode(m,{stream:!0}),!1)}l(c.decode(),!0)}async deploy(t,i){const r=await this.streamNdjson(`/api/workflows/${encodeURIComponent(t)}/deploy`,{method:"POST"},i);return lA(r)}async run(t){return this.request("/api/runs",{method:"POST",body:JSON.stringify(t)})}async streamNdjson(t,i,r){const o=await fetch(t,{...i,headers:{"Content-Type":"application/json","X-Harness-Token":co(),...i.headers}});if(!o.ok||!o.body){const y=await o.text().catch(()=>"");let v;try{const S=y?JSON.parse(y):void 0;S&&typeof S=="object"&&typeof S.error=="string"&&(v=S.error)}catch{}throw new ji(o.status,`${i.method??"GET"} ${t} → ${o.status}${y?`: ${y}`:""}`,v)}const c=[],f=o.body.getReader(),l=new TextDecoder;let d="";const m=y=>{d+=y;let v=d.indexOf(`
50
+ `);for(;v!==-1;){const S=d.slice(0,v);d=d.slice(v+1);const w=rA(S);w!==void 0&&(c.push(w),r==null||r(w)),v=d.indexOf(`
51
+ `)}};for(;;){const{done:y,value:v}=await f.read();if(y)break;m(l.decode(v,{stream:!0}))}return m(l.decode()+`
52
+ `),c}}function rA(e){const t=e.trim();if(t==="")return;let i;try{i=JSON.parse(t)}catch{return}return i===null?void 0:i}function aA(e,t){const i=e.split(`
53
+ `);if(t)return{lines:i.filter(o=>o.trim()!==""),rest:""};const r=i.pop()??"";return{lines:i.filter(o=>o.trim()!==""),rest:r}}function oA(e){const t=e.trim();if(t==="")return null;let i;try{i=JSON.parse(t)}catch{return null}return typeof i!="object"||i===null||Array.isArray(i)?null:i}function lA(e){for(let t=e.length-1;t>=0;t--){const i=e[t];if(i.phase==="ready"||i.phase==="error")return i}return{phase:"error",code:"NO_OUTPUT",message:"deploy produced no terminal status"}}function Kw(){return new nA}function Ul(e){var r,o;const t=(r=e.inputSchema)==null?void 0:r.properties;if(!t)return[];const i=new Set(((o=e.inputSchema)==null?void 0:o.required)??[]);return Object.entries(t).map(([c,f])=>({name:c,type:typeof(f==null?void 0:f.type)=="string"?f.type:"unknown",required:i.has(c)})).sort((c,f)=>Number(f.required)-Number(c.required))}function Yn(e){return e<1e3?`${e}ms`:`${Math.round(e/100)/10}s`}function cA(e,t){const i=[],r=Ul(e).length;r>0&&i.push(r===1?"1 input":`${r} inputs`);const o=t.filter(c=>c.from===e.id&&c.kind==="branching").length;return o>1&&i.push(`${o} branches`),e.timeoutMs&&e.timeoutMs>0&&i.push(`${Yn(e.timeoutMs)} limit`),i}function uA(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 dA(e){const{steps:t,exits:i}=uA(e),r=[`${t} ${t===1?"step":"steps"}`];return i>0&&r.push(`${i} ${i===1?"exit":"exits"}`),r.join(" · ")}function Yw(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 Fm(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(i=>Fm(i,t+1));if(typeof e=="object")return Object.fromEntries(Object.entries(e).map(([i,r])=>[i,Fm(r,t+1)]).filter(i=>i[1]!==void 0))}}function hA(e){if(!e||typeof e!="object")return null;const t=Fm(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function fA(e){if(!e||typeof e!="object")return null;const t=e;if(!Array.isArray(t.nodes)||!Array.isArray(t.edges))return null;const i=r=>typeof r=="string"?r:"";return{name:i(t.name),entry:i(t.entry),nodes:t.nodes.map(r=>({id:i(r.id),kind:i(r.kind),label:i(r.label),role:i(r.role),description:i(r.description),timeoutMs:typeof r.timeoutMs=="number"&&r.timeoutMs>0?r.timeoutMs:null,inputSchema:hA(r.inputSchema),capabilities:Array.isArray(r.capabilities)?r.capabilities.filter(o=>typeof o=="string"):[]})),edges:t.edges.map(r=>({from:i(r.from),to:i(r.to),kind:i(r.kind),label:i(r.label)})),groups:Array.isArray(t.groups)?t.groups.map(r=>({label:i(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 Xw="sapiom-harness-ui-prefs";function dn(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Xw);return e?JSON.parse(e):{}}catch{return{}}}function Kn(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Xw,JSON.stringify({...dn(),...e}))}catch{}}function Gv(e,t){return!e||e.stubbed!==!0?!1:e.steps.some(i=>i.name===t)}function pA(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 Sh(e,t){if(!e)return null;for(let i=e.steps.length-1;i>=0;i--)if(e.steps[i].name===t)return e.steps[i];return null}const pb=3e3,mb=2e3;function mA(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function vb(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>mb?`${t.slice(0,mb)}
54
+ … (truncated, ${t.length} chars total)`:t}function vA(e,t,i){const r=[];r.push(`Step: ${e.name}`),r.push(`Status: ${e.status}`),e.latencyMs!=null&&r.push(`Latency: ${mA(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
+ ${vb(t.input)}`),(t==null?void 0:t.output)!==void 0&&r.push(`
57
+ Output:
58
+ ${vb(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 f=c.stubUsed?" (stubbed)":"";r.push(` - ${c.capability}${f}`)}}else r.push(`
60
+ Capabilities called: none (the step made zero capability calls).`);else if(i!=null&&i.capabilities&&i.capabilities.length>0){r.push(`
61
+ Capabilities declared (no call trace):`);for(const c of i.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(),f=c.length>pb?c.slice(c.length-pb):c;r.push(`
64
+ Logs:
65
+ ${f}`)}return r.join(`
66
+ `)}const gA=/\.(png|jpg|jpeg|webp|gif|svg)($|\?)/i,_A=/https?:\/\/[^\s"'<>`\])\]]+/gi,yA=/[.,;:)\]}\s]+$/;function gb(e){if(typeof e=="string")return e;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function bA(e){const t=new Set,i=[],r=o=>{const c=o.matchAll(_A);for(const[f]of c){const l=f.replace(yA,"");if(!l||t.has(l))continue;t.add(l);const d=gA.test(l)?"image":"other";i.push({url:l,kind:d})}};if(e.output!==void 0&&r(gb(e.output)),e.logSlice&&r(e.logSlice),e.calls)for(const o of e.calls)o.result!==void 0&&r(gb(o.result));return i}const wh="https://app.sapiom.ai",Jw=`${wh}/agents`,_b=`${wh}/settings?tab=billing`,SA=wh;function xh(e){return`${Jw}/${e}`}const wA="https://docs.sapiom.ai",xA=`${wA}/agents/quick-start`;function Zw(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 Qw=(...e)=>e.filter((t,i,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===i).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 CA=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 EA=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,i,r)=>r?r.toUpperCase():i.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 yb=e=>{const t=EA(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 Up={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 kA=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},AA=z.createContext({}),jA=()=>z.useContext(AA),RA=z.forwardRef(({color:e,size:t,strokeWidth:i,absoluteStrokeWidth:r,className:o="",children:c,iconNode:f,...l},d)=>{const{size:m=24,strokeWidth:y=2,absoluteStrokeWidth:v=!1,color:S="currentColor",className:w=""}=jA()??{},R=r??v?Number(i??y)*24/Number(t??m):i??y;return z.createElement("svg",{ref:d,...Up,width:t??m??Up.width,height:t??m??Up.height,stroke:e??S,strokeWidth:R,className:Qw("lucide",w,o),...!c&&!kA(l)&&{"aria-hidden":"true"},...l},[...f.map(([x,g])=>z.createElement(x,g)),...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 He=(e,t)=>{const i=z.forwardRef(({className:r,...o},c)=>z.createElement(RA,{ref:c,iconNode:t,className:Qw(`lucide-${CA(yb(e))}`,`lucide-${e}`,r),...o}));return i.displayName=yb(e),i};/**
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 TA=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],NA=He("arrow-down",TA);/**
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 MA=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],DA=He("arrow-left",MA);/**
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 OA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],$A=He("arrow-right",OA);/**
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 LA=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],IA=He("arrow-up-right",LA);/**
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 PA=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],BA=He("arrow-up",PA);/**
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 HA=[["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"}]],zA=He("book-open",HA);/**
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 UA=[["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"}]],qA=He("brain",UA);/**
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 FA=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],VA=He("check",FA);/**
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 WA=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],GA=He("chevron-down",WA);/**
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 KA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],YA=He("chevron-right",KA);/**
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 XA=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],JA=He("chevron-up",XA);/**
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 ZA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],QA=He("circle-check",ZA);/**
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 ej=[["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"}]],tj=He("circle-question-mark",ej);/**
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 sj=[["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"}]],ij=He("cloud-off",sj);/**
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 nj=[["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"}]],rj=He("cloud-upload",nj);/**
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 aj=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],oj=He("cloud",aj);/**
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 lj=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],cj=He("code",lj);/**
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 uj=[["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"}]],dj=He("copy",uj);/**
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 hj=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],fj=He("corner-down-right",hj);/**
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 pj=[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]],mj=He("corner-left-up",pj);/**
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 vj=[["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"}]],gj=He("ellipsis-vertical",vj);/**
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 _j=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],yj=He("ellipsis",_j);/**
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 bj=[["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"}]],Sj=He("external-link",bj);/**
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 wj=[["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"}]],xj=He("flask-conical",wj);/**
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 Cj=[["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"}]],Ej=He("folder-open",Cj);/**
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 kj=[["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"}]],Aj=He("folder-plus",kj);/**
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 jj=[["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"}]],Rj=He("folder",jj);/**
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 Tj=[["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"}]],Nj=He("frame",Tj);/**
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 Mj=[["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"}]],Dj=He("globe",Mj);/**
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 Oj=[["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"}]],$j=He("hammer",Oj);/**
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 Lj=[["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"}]],Ij=He("history",Lj);/**
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 Pj=[["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"}]],Bj=He("image-up",Pj);/**
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 Hj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],zj=He("info",Hj);/**
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 Uj=[["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"}]],qj=He("layout-template",Uj);/**
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 Fj=[["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"}]],Vj=He("list-checks",Fj);/**
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 Wj=[["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"}]],Gj=He("list",Wj);/**
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 Kj=[["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"}]],Yj=He("loader",Kj);/**
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 Xj=[["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"}]],Jj=He("log-out",Xj);/**
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 Zj=[["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"}]],Qj=He("maximize-2",Zj);/**
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 eR=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],tR=He("menu",eR);/**
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 sR=[["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"}]],iR=He("message-square",sR);/**
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 nR=[["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"}]],rR=He("minimize-2",nR);/**
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 aR=[["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"}]],oR=He("moon",aR);/**
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 lR=[["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"}]],cR=He("panel-left-close",lR);/**
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 uR=[["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"}]],dR=He("panel-left-open",uR);/**
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 hR=[["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"}]],fR=He("panel-right-close",hR);/**
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 pR=[["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"}]],mR=He("panel-right-open",pR);/**
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 vR=[["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"}]],gR=He("paperclip",vR);/**
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 _R=[["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"}]],yR=He("pencil",_R);/**
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 bR=[["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"}]],SR=He("play",bR);/**
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 wR=[["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"}]],xR=He("plug",wR);/**
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 CR=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ER=He("plus",CR);/**
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 kR=[["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"}]],AR=He("radio",kR);/**
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 jR=[["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"}]],RR=He("refresh-cw",jR);/**
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 TR=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],NR=He("search",TR);/**
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 MR=[["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"}]],DR=He("settings",MR);/**
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 OR=[["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"}]],$R=He("sparkles",OR);/**
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 LR=[["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"}]],IR=He("square-terminal",LR);/**
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 PR=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],BR=He("square",PR);/**
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 HR=[["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"}]],zR=He("sun",HR);/**
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 UR=[["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"}]],qR=He("tags",UR);/**
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 FR=[["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"}]],VR=He("trash-2",FR);/**
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 WR=[["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"}]],GR=He("triangle-alert",WR);/**
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 KR=[["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"}]],YR=He("wand-sparkles",KR);/**
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 XR=[["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"}]],JR=He("workflow",XR);/**
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 ZR=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],QR=He("x",ZR);/**
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 eT=[["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"}]],tT=He("zap",eT);/**
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 sT=[["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"}]],iT=He("zoom-in",sT);/**
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 nT=[["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"}]],rT=He("zoom-out",nT),aT={ArrowDown:NA,ArrowLeft:DA,ArrowRight:$A,ArrowUp:BA,ArrowUpRight:IA,BookOpen:zA,Brain:qA,Check:VA,ChevronDown:GA,ChevronRight:YA,ChevronUp:JA,CircleCheck:QA,Cloud:oj,CloudOff:ij,CloudUpload:rj,Code:cj,Copy:dj,CornerDownRight:fj,CornerLeftUp:mj,ExternalLink:Sj,FlaskConical:xj,Folder:Rj,FolderOpen:Ej,FolderPlus:Aj,Frame:Nj,Globe:Dj,Hammer:$j,History:Ij,ImageUp:Bj,Info:zj,LayoutTemplate:qj,List:Gj,ListChecks:Vj,Loader:Yj,LogOut:Jj,Maximize2:Qj,Menu:tR,MessageSquare:iR,Minimize2:rR,MoreHorizontal:yj,MoreVertical:gj,Moon:oR,PanelLeftClose:cR,PanelLeftOpen:dR,PanelRightClose:fR,PanelRightOpen:mR,Paperclip:gR,Pencil:yR,Play:SR,Plug:xR,Plus:ER,Radio:AR,RefreshCw:RR,Search:NR,Settings:DR,Sparkles:$R,Square:BR,SquareTerminal:IR,Sun:zR,Tags:qR,Trash2:VR,TriangleAlert:GR,Wand2:YR,Workflow:JR,X:QR,Zap:tT,ZoomIn:iT,ZoomOut:rT};function de({name:e,size:t=16}){const i=aT[e]??tj;return h.jsx(i,{size:t,strokeWidth:1.75,"aria-hidden":"true"})}const oT="data-ph-capture-attribute-";function $t(e){const t={};for(const[i,r]of Object.entries(e)){if(r==null)continue;const o=String(r);o.length!==0&&(t[`${oT}${i}`]=o)}return t}const Ga=8,lT=1200,bb=12;function cT(e){return/<\/?(?:!doctype|html|head|body|style|script|main|section|article|div|span|img|svg|meta|link)\b/i.test(e)}function uT(e){const t=e.split(/\r?\n/),r=t.slice(0,bb).join(`
447
+ `).slice(0,lT),o=t.length>bb||e.length>r.length;return{kind:cT(e)?"html":"text",truncated:o,preview:o?`${r.trimEnd()}
448
+ …`:e,omittedCharacters:o?Math.max(0,e.length-r.length):0}}function dT(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 ex(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"?t:null}catch{return null}}function hT(e){var t;return((t=e.pathname.split(".").pop())==null?void 0:t.toLowerCase())??""}function tx(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 fT({url:e}){const[t,i]=z.useState(!1),r=hT(e),o=tx(e),c=["png","jpg","jpeg","gif","webp","avif","svg"].includes(r),f=["mp3","wav","ogg","m4a","aac"].includes(r),l=["mp4","webm","mov","m4v"].includes(r),d=["pdf","zip","csv","json","docx","xlsx","pptx","txt"].includes(r);return t||!c&&!f&&!l?h.jsxs("a",{className:"artifact-link",href:e.href,target:"_blank",rel:"noreferrer",download:d||void 0,children:[h.jsx(de,{name:t?"TriangleAlert":d?"ArrowDown":"ExternalLink",size:13}),h.jsx("span",{children:t?`Preview unavailable · ${o}`:d?`Download · ${o}`:o})]}):c?h.jsxs("figure",{className:"artifact-media",children:[h.jsx("img",{src:e.href,alt:o,loading:"lazy",onError:()=>i(!0)}),h.jsx("figcaption",{children:h.jsx("a",{href:e.href,target:"_blank",rel:"noreferrer",children:o})})]}):f?h.jsxs("figure",{className:"artifact-media",children:[h.jsx("audio",{controls:!0,preload:"metadata",onError:()=>i(!0),children:h.jsx("source",{src:e.href})}),h.jsx("figcaption",{children:h.jsx("a",{href:e.href,target:"_blank",rel:"noreferrer",children:o})})]}):h.jsxs("figure",{className:"artifact-media",children:[h.jsx("video",{controls:!0,preload:"metadata",onError:()=>i(!0),children:h.jsx("source",{src:e.href})}),h.jsx("figcaption",{children:h.jsx("a",{href:e.href,target:"_blank",rel:"noreferrer",children:o})})]})}function qp(e){const t=[],i=/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)|(https?:\/\/[^\s<]+)/g;let r=0,o;for(;o=i.exec(e);){o.index>r&&t.push(e.slice(r,o.index));const c=o[2]??o[3],f=c?ex(c.replace(/[.,;!?]+$/,"")):null;f?t.push(h.jsx("a",{href:f.href,target:"_blank",rel:"noreferrer",children:o[1]??tx(f)},`${o.index}-${f.href}`)):t.push(o[0]),r=i.lastIndex}return r<e.length&&t.push(e.slice(r)),t}function pT({text:e}){const t=e.split(/\r?\n/),i=[];let r=[],o=[];const c=()=>{if(r.length===0)return;const l=r.join(`
449
+ `);i.push(h.jsx("p",{children:qp(l)},`p-${i.length}`)),r=[]},f=()=>{o.length!==0&&(i.push(h.jsx("ul",{children:o.map((l,d)=>h.jsx("li",{children:qp(l)},d))},`l-${i.length}`)),o=[])};for(const l of t){const d=/^(#{1,3})\s+(.+)$/.exec(l),m=/^[-*]\s+(.+)$/.exec(l);if(d){c(),f();const y=qp(d[2]);i.push(d[1].length===1?h.jsx("h3",{children:y},i.length):d[1].length===2?h.jsx("h4",{children:y},i.length):h.jsx("h5",{children:y},i.length))}else m?(c(),o.push(m[1])):l.trim()===""?(c(),f()):(f(),r.push(l))}return c(),f(),h.jsx("div",{className:"artifact-markdown",children:i})}function sx({text:e,forceSource:t=!1}){const[i,r]=z.useState(!1);z.useEffect(()=>r(!1),[e]);const o=uT(e),c=t||o.kind==="html",f=i?e:o.preview;return h.jsxs("div",{className:"artifact-text","data-kind":c?"source":"text",children:[c?h.jsx("pre",{className:"artifact-source",children:f}):h.jsx(pT,{text:f}),o.truncated&&h.jsxs("button",{type:"button",className:"btn-ghost artifact-text-more","aria-expanded":i,onClick:()=>r(l=>!l),children:[h.jsx(de,{name:i?"ChevronUp":"ChevronDown",size:12}),i?"Show less":`Show full ${c?"HTML":"text"} · ${o.omittedCharacters.toLocaleString()} more characters`]})]})}function Fp(e){return e!==null&&typeof e=="object"}function Dd({value:e}){if(typeof e=="string"){const t=ex(e);return t?h.jsx(fT,{url:t},t.href):h.jsx(sx,{text:e})}if(e===null||typeof e=="number"||typeof e=="boolean")return h.jsx("code",{className:"artifact-scalar",children:String(e)});if(Array.isArray(e)){if(e.length===0)return h.jsx("code",{className:"artifact-scalar",children:"[]"});const t=e.slice(0,Ga),i=e.slice(Ga);return h.jsxs("div",{className:"artifact-list",children:[t.map((r,o)=>h.jsxs("div",{className:"artifact-list-item","data-composite":Fp(r)||void 0,children:[h.jsx("span",{className:"artifact-list-index",children:o+1}),h.jsx(Dd,{value:r})]},o)),i.length>0&&h.jsxs("details",{className:"artifact-collection-more",children:[h.jsxs("summary",{children:["Show ",i.length," more"]}),i.map((r,o)=>h.jsxs("div",{className:"artifact-list-item","data-composite":Fp(r)||void 0,children:[h.jsx("span",{className:"artifact-list-index",children:o+Ga+1}),h.jsx(Dd,{value:r})]},o+Ga))]})]})}if(typeof e=="object"){const t=Object.entries(e);if(t.length===0)return h.jsx("code",{className:"artifact-scalar",children:"{}"});const i=t.slice(0,Ga),r=t.slice(Ga),o=c=>c.map(([f,l])=>h.jsxs("div",{className:"artifact-field","data-composite":Fp(l)||void 0,children:[h.jsx("div",{className:"artifact-field-label",children:f.replaceAll(/[_-]+/g," ")}),h.jsx("div",{className:"artifact-field-value",children:h.jsx(Dd,{value:l})})]},f));return h.jsxs("div",{className:"artifact-object",children:[o(i),r.length>0&&h.jsxs("details",{className:"artifact-collection-more",children:[h.jsxs("summary",{children:["Show ",r.length," more fields"]}),o(r)]})]})}return h.jsx("code",{className:"artifact-scalar",children:String(e)})}function ql({value:e,label:t="Result",testId:i="run-artifact",defaultOpen:r=!0,onViewed:o,viewEventKey:c="default"}){const[f,l]=z.useState("rendered"),[d,m]=z.useState(r),[y,v]=z.useState(!1),S=z.useRef(null),w=z.useRef(null),R=z.useId(),x=z.useId(),g=z.useId(),b=z.useRef(null),p=z.useRef(null),_=Zw(e);z.useEffect(()=>{!o||S.current===c||(S.current=c,o())},[o,c]),z.useEffect(()=>()=>{w.current&&window.clearTimeout(w.current)},[]);const k=C=>{l(C),m(!0)},A=C=>{var j;let N=null;C.key==="Home"&&(N="rendered"),C.key==="End"&&(N="raw"),["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(C.key)&&(N=f==="rendered"?"raw":"rendered"),N!==null&&(C.preventDefault(),k(N),(j=(N==="rendered"?b:p).current)==null||j.focus())};return h.jsxs("section",{className:"artifact-renderer","data-testid":i,"data-collapsed":!d||void 0,...$t({object:"run"}),children:[h.jsxs("header",{className:"artifact-header",children:[h.jsxs("button",{type:"button",className:"artifact-disclosure","aria-expanded":d,"aria-controls":R,onClick:()=>m(C=>!C),children:[h.jsx(de,{name:d?"ChevronDown":"ChevronRight",size:13}),h.jsx("span",{className:"artifact-title",children:t})]}),h.jsxs("div",{className:"artifact-actions",children:[h.jsxs("div",{className:"artifact-mode",role:"tablist","aria-label":`${t} display`,children:[h.jsx("button",{ref:b,id:x,type:"button",role:"tab","aria-controls":R,"aria-selected":f==="rendered",tabIndex:f==="rendered"?0:-1,onKeyDown:A,onClick:()=>k("rendered"),children:"Rendered"}),h.jsx("button",{ref:p,id:g,type:"button",role:"tab","aria-controls":R,"aria-selected":f==="raw",tabIndex:f==="raw"?0:-1,onKeyDown:A,onClick:()=>k("raw"),children:"Raw"})]}),h.jsxs("button",{type:"button",className:"btn-ghost artifact-copy",onClick:()=>void(async()=>{var N;let C=!1;try{(N=navigator.clipboard)!=null&&N.writeText&&(await navigator.clipboard.writeText(_),C=!0)}catch{}C||(C=dT(_)),C&&(v(!0),w.current&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>v(!1),1500))})(),children:[h.jsx(de,{name:y?"Check":"Copy",size:12})," ",y?"Copied":"Copy"]})]})]}),h.jsx("div",{className:"artifact-body",id:R,role:"tabpanel","aria-labelledby":f==="rendered"?x:g,hidden:!d,children:f==="rendered"?h.jsx(Dd,{value:e}):h.jsx(sx,{text:_,forceSource:!0})})]})}function Kv(){return h.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:i}){return h.jsx(ql,{value:t,label:e,testId:i,defaultOpen:!1})}function mT({links:e,testid:t}){return h.jsx("div",{className:"canvas-links-list","data-testid":t,children:e.map(({url:i,kind:r})=>r==="image"?h.jsx("a",{href:i,target:"_blank",rel:"noreferrer",className:"canvas-link-thumb-wrap","data-testid":"canvas-link-image",children:h.jsx("img",{src:i,alt:"",className:"canvas-link-thumb",loading:"lazy"})},i):h.jsxs("a",{href:i,target:"_blank",rel:"noreferrer",className:"canvas-link-item","data-testid":"canvas-link-other",children:[h.jsx(de,{name:"ExternalLink",size:12}),h.jsx("span",{className:"canvas-link-url",children:"Open"})]},i))})}function ix({step:e}){const t=bA(e);return t.length===0?null:h.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-links",children:[h.jsx("h4",{children:"Links"}),h.jsx(mT,{links:t})]})}function vT({status:e}){return e==="completed"?h.jsx("span",{className:"canvas-run-status is-passed","aria-label":"completed",children:h.jsx(de,{name:"Check",size:11})}):e==="failed"?h.jsx("span",{className:"canvas-run-status is-failed","aria-label":"failed",children:h.jsx(de,{name:"X",size:11})}):e==="cancelled"?h.jsx("span",{className:"canvas-run-status is-pending","aria-label":"cancelled",children:h.jsx(de,{name:"Minus",size:11})}):h.jsx("span",{className:"canvas-run-status is-running","aria-label":"running"})}function gT({deployState:e,workflow:t,onDismiss:i,onOpenCode:r}){const o=(t==null?void 0:t.definitionId)!=null?xh(t.definitionId):null,c=e.phase==="linking"||e.phase==="building",f=e.phase==="linking"?"Creating the agent on Sapiom…":e.phase==="building"?"Deploying — building on Sapiom…":e.phase==="ready"?"Deployed to Sapiom":"Deploy failed";return h.jsxs("section",{className:"deploy-status-banner is-"+e.phase,"data-testid":"deploy-status-banner","data-phase":e.phase,children:[h.jsxs("div",{className:"deploy-status-head",children:[c?h.jsx("span",{className:"canvas-task-spinner","aria-hidden":"true"}):h.jsx(vT,{status:e.phase==="ready"?"completed":"failed"}),h.jsx("span",{className:"deploy-status-label",children:f}),h.jsx("button",{type:"button",className:"deploy-status-dismiss","data-testid":"deploy-status-dismiss","aria-label":"Dismiss",onClick:i,children:h.jsx(de,{name:"X",size:12})})]}),e.phase==="error"&&e.message&&h.jsx("pre",{className:"canvas-run-error",children:e.message}),e.phase==="ready"&&h.jsxs("div",{className:"deploy-status-actions",children:[o&&h.jsxs("a",{className:"status-tag status-tag-action","data-testid":"deploy-open-dashboard",href:o,target:"_blank",rel:"noreferrer",children:[h.jsx(de,{name:"Cloud",size:12}),"Open in Sapiom"]}),h.jsxs("button",{type:"button",className:"status-tag status-tag-action","data-testid":"deploy-open-code",onClick:r,children:[h.jsx(de,{name:"Code",size:12}),"Trigger from your code"]})]})]})}function nx({step:e}){return!e.calls||e.calls.length===0?null:h.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-capability-calls",children:[h.jsx("h4",{children:"Capability calls"}),h.jsx("div",{className:"canvas-capability-calls",children:e.calls.map((t,i)=>h.jsxs("div",{className:"canvas-capability-call",children:[h.jsxs("div",{className:"canvas-capability-call-head",children:[h.jsx("code",{className:"canvas-input-field",children:t.capability}),t.stubUsed&&h.jsx("span",{className:"canvas-run-stub-chip","data-testid":`canvas-call-stub-chip-${t.capability}`,children:"stubbed"})]}),t.args!==void 0&&h.jsx(wr,{label:"Arguments",value:t.args,testId:`canvas-call-arguments-${t.capability}`}),t.result!==void 0&&h.jsx(wr,{label:"Result",value:t.result,testId:`canvas-call-result-${t.capability}`})]},`${t.capability}-${i}`))})]})}function rx({run:e}){const t=pA(e);return t?h.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-stub-notice",children:[h.jsx("h4",{children:"Stub notices"}),t.unusedStubs&&h.jsxs("div",{className:"canvas-stub-notice","data-testid":"canvas-stub-unused",children:[h.jsx("span",{className:"canvas-input-label",children:"Unused stubs"}),h.jsx("p",{className:"canvas-stub-notice-hint",children:"Supplied but matched no capability call — likely a typo or wrong path."}),h.jsx("ul",{className:"canvas-detail-warnings",children:t.unusedStubs.map(i=>h.jsxs("li",{children:[h.jsx("code",{className:"canvas-input-field",children:i.key})," in ",i.step]},`${i.step} ${i.key}`))})]}),t.stubWarnings&&h.jsxs("div",{className:"canvas-stub-notice","data-testid":"canvas-stub-warnings",children:[h.jsx("span",{className:"canvas-input-label",children:"Stub warnings"}),h.jsx("p",{className:"canvas-stub-notice-hint",children:"Matched a call but had the wrong shape."}),h.jsx("ul",{className:"canvas-detail-warnings",children:t.stubWarnings.map(i=>h.jsx("li",{children:i},i))})]})]}):null}function _T(e){return e?`${e} run`:"run"}function Yv({status:e}){return e==="passed"?h.jsx("span",{className:"canvas-run-status is-passed","data-status":"passed","aria-label":"passed",children:h.jsx(de,{name:"Check",size:11})}):e==="failed"?h.jsx("span",{className:"canvas-run-status is-failed","data-status":"failed","aria-label":"failed",children:h.jsx(de,{name:"X",size:11})}):e==="running"?h.jsx("span",{className:"canvas-run-status is-running","data-status":"running","aria-label":"running"}):h.jsx("span",{className:"canvas-run-status is-pending","data-status":"pending","aria-label":"pending"})}function yu(e){return e.kind==="branching"?"branch":e.kind==="cross"?"pause resume":e.kind==="launch"?"launch":null}function yT({node:e}){const t=Ul(e);return t.length===0?null:h.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-step-input-${e.id}`,children:[h.jsx("span",{className:"canvas-input-label",children:"Input"}),h.jsx("span",{className:"canvas-input-fields",children:t.map(i=>h.jsxs("code",{className:"canvas-input-field"+(i.required?" is-required":""),"aria-label":`${i.name}, ${i.type}${i.required?", required":""}`,...$t({object:"run"}),children:[i.name,i.required&&h.jsx("span",{"aria-hidden":"true",children:"*"}),h.jsx("span",{className:"canvas-input-type",children:i.type})]},i.name))})]})}function bT({node:e}){return e.capabilities.length===0?null:h.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-step-capabilities-${e.id}`,children:[h.jsx("span",{className:"canvas-input-label",children:"Capabilities"}),h.jsx("span",{className:"canvas-input-fields",children:e.capabilities.map(t=>h.jsx("code",{className:"canvas-input-field","data-tooltip":"Sapiom capability this step calls",children:t},t))})]})}function ST(e,t){return e.kind!=="launched-workflow"?null:t.find(i=>i.path===e.label)??t.find(i=>i.name===e.label)??t.find(i=>i.path.endsWith(`/${e.label}`))??null}function ax({node:e,workflows:t,onOpenWorkflow:i}){const r=ST(e,t);return r?h.jsxs("button",{className:"canvas-step-open","data-testid":`canvas-open-workflow-${e.id}`,"data-tooltip":`Switch to ${r.name}`,onClick:()=>i(r.path),children:["Open agent ",h.jsx(de,{name:"ArrowRight",size:12})]}):null}function wT({graph:e,run:t,runTarget:i,workflows:r,onOpenWorkflow:o,onAskAgent:c,expandedId:f,onToggle:l}){const d=new Set(e.nodes.map(S=>S.id)),m=e.groups.filter(S=>S.nodeIds.length>0&&S.nodeIds.every(w=>d.has(w))),y=S=>{var w;return((w=m.find(R=>R.nodeIds.includes(S)))==null?void 0:w.label)??null},v=[];return e.nodes.forEach((S,w)=>{const R=y(S.id),x=v[v.length-1];x&&x.group===R?x.nodes.push({node:S,index:w}):v.push({group:R,nodes:[{node:S,index:w}]})}),h.jsxs("div",{className:"canvas-steps-list","data-testid":"canvas-steps-list",children:[h.jsxs("div",{className:"canvas-steps-label",children:["Steps",t&&h.jsx("span",{className:"canvas-steps-run-note","data-testid":"canvas-steps-run-note",children:_T(i)})]}),v.map((S,w)=>h.jsxs("div",{className:S.group?"canvas-step-band":void 0,children:[S.group&&h.jsx("div",{className:"canvas-step-group",children:S.group}),S.nodes.map(({node:R,index:x})=>{const g=f===R.id,b=cA(R,e.edges),p=Sh(t,R.id),_=p?[p.latencyMs!==void 0?Yn(p.latencyMs):null].filter(k=>k!==null):[];return h.jsxs("div",{className:"canvas-step-item"+(g?" is-open":""),children:[h.jsxs("button",{className:"canvas-step-row","data-testid":`canvas-step-row-${R.id}`,"aria-expanded":g,onClick:()=>l(R.id),children:[h.jsx("span",{className:"canvas-step-index",children:String(x+1).padStart(2,"0")}),p?h.jsx(Yv,{status:p.status}):h.jsx("span",{className:"canvas-step-dot dot--"+R.kind,"aria-hidden":"true"}),h.jsxs("span",{className:"canvas-step-copy",children:[h.jsx("span",{className:"canvas-step-name",children:R.label}),h.jsx("span",{className:"canvas-step-role",children:R.role})]}),p&&Gv(t,R.id)&&h.jsx(Kv,{}),h.jsx("span",{className:"canvas-step-meta",children:(_.length>0?_:b).join(" · ")}),h.jsx("span",{className:"canvas-step-caret"+(g?" is-open":""),"aria-hidden":"true",children:h.jsx(de,{name:"ChevronDown",size:13})})]}),g&&h.jsx("div",{className:"canvas-step-expand","data-testid":`canvas-step-expand-${R.id}`,children:h.jsx(xT,{graph:e,node:R,run:t,workflows:r,onOpenWorkflow:o,onAskAgent:c})})]},R.id)})]},`${S.group??"ungrouped"}-${w}`))]})}function xT({graph:e,node:t,run:i,workflows:r,onOpenWorkflow:o,onAskAgent:c}){const f=Sh(i,t.id),l=e.edges.filter(v=>v.from===t.id),d=e.edges.filter(v=>v.to===t.id),m=v=>{var S;return((S=e.nodes.find(w=>w.id===v))==null?void 0:S.label)??v},y=e.groups.filter(v=>v.nodeIds.includes(t.id));return h.jsx("div",{className:"canvas-detail","data-testid":"canvas-step-detail",children:h.jsxs("div",{className:"canvas-detail-body",children:[t.role&&h.jsx("p",{className:"canvas-detail-role",children:t.role}),t.description&&h.jsx("p",{className:"canvas-detail-desc",children:t.description}),y.length>0&&h.jsxs("p",{className:"canvas-detail-groups",children:["Part of ",y.map(v=>v.label).join(", ")]}),c&&h.jsxs("div",{className:"canvas-detail-actions",children:[h.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:[h.jsx(de,{name:"MessageSquare",size:13}),"Ask coding agent"]}),h.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:[h.jsx(de,{name:"Wand2",size:13}),"Ask to modify"]}),h.jsxs("button",{type:"button",className:"btn-ghost","data-testid":"canvas-detail-copy-name","data-tooltip":"Copy the step name",onClick:()=>{var v;return void((v=navigator.clipboard)==null?void 0:v.writeText(t.label).catch(()=>{}))},children:[h.jsx(de,{name:"Copy",size:13}),"Copy name"]})]}),h.jsx(ax,{node:t,workflows:r,onOpenWorkflow:o}),f&&h.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-run",children:[h.jsx("h4",{children:"Agent run"}),h.jsxs("div",{className:"canvas-detail-contract",children:[h.jsx("span",{className:"canvas-input-label",children:"Status"}),h.jsxs("span",{className:"canvas-run-text is-"+f.status,children:[h.jsx(Yv,{status:f.status}),f.status,Gv(i,t.id)&&h.jsx(Kv,{})]})]}),f.latencyMs!==void 0&&h.jsxs("div",{className:"canvas-detail-contract",children:[h.jsx("span",{className:"canvas-input-label",children:"Duration"}),h.jsx("span",{className:"canvas-detail-timeout",children:Yn(f.latencyMs)})]}),f.input!==void 0&&h.jsx(wr,{label:"Input",value:f.input,testId:`canvas-detail-run-input-${t.id}`}),f.output!==void 0&&h.jsx(wr,{label:"Output",value:f.output,testId:`canvas-detail-run-output-${t.id}`}),f.error&&h.jsx("pre",{className:"canvas-run-error",children:f.error}),f.logSlice&&h.jsx(wr,{label:"Logs",value:f.logSlice,testId:`canvas-detail-run-logs-${t.id}`})]}),f&&h.jsx(nx,{step:f}),f&&h.jsx(ix,{step:f}),h.jsx(rx,{run:i}),(Ul(t).length>0||t.timeoutMs!==null||t.capabilities.length>0)&&h.jsxs("section",{className:"canvas-detail-section",children:[h.jsx("h4",{children:"Contract"}),t.capabilities.length>0&&h.jsxs("div",{className:"canvas-detail-contract","data-testid":"canvas-detail-capabilities",children:[h.jsx("span",{className:"canvas-input-label",children:"Capabilities"}),h.jsx("span",{className:"canvas-input-fields",children:t.capabilities.map(v=>h.jsx("code",{className:"canvas-input-field","data-tooltip":"Sapiom capability this step calls",children:v},v))})]}),Ul(t).length>0&&h.jsxs("div",{className:"canvas-detail-contract","data-testid":"canvas-detail-input",children:[h.jsx("span",{className:"canvas-input-label",children:"Input"}),h.jsx("span",{className:"canvas-input-fields",children:Ul(t).map(v=>h.jsxs("code",{className:"canvas-input-field"+(v.required?" is-required":""),"aria-label":`${v.name}, ${v.type}${v.required?", required":""}`,"data-tooltip":v.required?"Required field":"Optional field",...$t({object:"run"}),children:[v.name,v.required&&h.jsx("span",{"aria-hidden":"true",children:"*"}),h.jsx("span",{className:"canvas-input-type",children:v.type})]},v.name))})]}),t.timeoutMs!==null&&h.jsxs("div",{className:"canvas-detail-contract",children:[h.jsx("span",{className:"canvas-input-label",children:"Timeout"}),h.jsx("span",{className:"canvas-detail-timeout",children:Yn(t.timeoutMs)})]})]}),h.jsxs("section",{className:"canvas-detail-section",children:[h.jsxs("h4",{children:["Leads to ",h.jsx("span",{className:"canvas-detail-count",children:l.length})]}),l.length===0?h.jsx("p",{className:"canvas-detail-empty",children:"Terminal step: nothing follows."}):h.jsx("ul",{className:"canvas-detail-edges",children:l.map(v=>h.jsx("li",{children:h.jsxs("div",{className:"canvas-detail-edge",children:[h.jsx(de,{name:"CornerDownRight",size:13}),h.jsx("span",{className:"canvas-detail-edge-target",children:m(v.to)}),yu(v)&&h.jsx("span",{className:"canvas-detail-edge-kind",children:yu(v)}),v.label&&h.jsx("span",{className:"canvas-detail-edge-cond",children:v.label})]})},`${v.from}->${v.to}`))})]}),h.jsxs("section",{className:"canvas-detail-section",children:[h.jsxs("h4",{children:["Reached from ",h.jsx("span",{className:"canvas-detail-count",children:d.length})]}),d.length===0?h.jsx("p",{className:"canvas-detail-empty",children:t.kind==="entry"?"Entry point: the agent starts here.":"No step routes here."}):h.jsx("ul",{className:"canvas-detail-edges",children:d.map(v=>h.jsx("li",{children:h.jsxs("div",{className:"canvas-detail-edge",children:[h.jsx(de,{name:"CornerLeftUp",size:13}),h.jsx("span",{className:"canvas-detail-edge-target",children:m(v.from)}),yu(v)&&h.jsx("span",{className:"canvas-detail-edge-kind",children:yu(v)}),v.label&&h.jsx("span",{className:"canvas-detail-edge-cond",children:v.label})]})},`${v.from}->${v.to}`))})]}),e.warnings.length>0&&h.jsxs("section",{className:"canvas-detail-section",children:[h.jsxs("h4",{children:["Graph warnings ",h.jsx("span",{className:"canvas-detail-count",children:e.warnings.length})]}),h.jsx("ul",{className:"canvas-detail-warnings",children:e.warnings.map(v=>h.jsx("li",{children:v},v))})]})]})})}function CT({node:e,run:t,workflows:i,onOpenWorkflow:r}){const o=Sh(t,e.id);return h.jsxs("div",{className:"canvas-inspector","data-testid":"canvas-step-inspector",children:[e.role&&h.jsx("p",{className:"canvas-detail-role",children:e.role}),e.description&&h.jsx("p",{className:"canvas-step-desc",children:e.description}),h.jsx(yT,{node:e}),h.jsx(bT,{node:e}),e.timeoutMs!==null&&h.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-inspector-timeout-${e.id}`,children:[h.jsx("span",{className:"canvas-input-label",children:"Timeout"}),h.jsx("span",{className:"canvas-detail-timeout",children:Yn(e.timeoutMs)})]}),h.jsx(ax,{node:e,workflows:i,onOpenWorkflow:r}),o&&h.jsxs("div",{className:"canvas-inspector-run","data-testid":"canvas-inspector-run",children:[h.jsx("span",{className:"canvas-input-label",children:"Agent run"}),h.jsxs("span",{className:"canvas-run-text is-"+o.status,children:[h.jsx(Yv,{status:o.status}),o.status,Gv(t,e.id)&&h.jsx(Kv,{})]}),o.latencyMs!==void 0&&h.jsx("span",{className:"canvas-inspector-run-meta",children:Yn(o.latencyMs)})]}),(o==null?void 0:o.input)!==void 0&&h.jsx(wr,{label:"Input",value:o.input,testId:`canvas-inspector-run-input-${e.id}`}),(o==null?void 0:o.output)!==void 0&&h.jsx(wr,{label:"Output",value:o.output,testId:`canvas-inspector-run-output-${e.id}`}),(o==null?void 0:o.error)&&h.jsx("pre",{className:"canvas-run-error",children:o.error}),(o==null?void 0:o.logSlice)&&h.jsx(wr,{label:"Logs",value:o.logSlice,testId:`canvas-inspector-run-logs-${e.id}`}),o&&h.jsx(nx,{step:o}),o&&h.jsx(ix,{step:o}),h.jsx(rx,{run:t})]})}function ET({node:e,run:t,onInjectPrompt:i,onClose:r}){const o=e?Sh(t,e.id):null,[c,f]=z.useState("");function l(m){var w;if(!e){i(m);return}const y=o?{input:o.input,output:o.output,calls:o.calls,unusedStubs:(w=t==null?void 0:t.unusedStubs)==null?void 0:w.map(R=>R.key),stubWarnings:t==null?void 0:t.stubWarnings}:void 0,v=e.capabilities.length>0?{capabilities:e.capabilities}:void 0,S=vA(o??{id:e.id,name:e.id,status:"pending"},y,v);i(`${S}
450
+
451
+ ${m}`)}function d(){const m=c.trim();m&&(l(m),f(""))}return h.jsxs("div",{className:"canvas-chat-panel","data-testid":"canvas-chat-panel",children:[h.jsxs("div",{className:"canvas-chat-head",children:[h.jsx("span",{className:"canvas-chat-title","data-testid":"canvas-chat-title",children:e?`Chat · ${e.label}`:"Chat"}),h.jsx("button",{className:"theme-toggle canvas-chat-close","data-testid":"canvas-chat-close","aria-label":"Close chat","data-tooltip":"Close chat",onClick:r,children:h.jsx(de,{name:"X",size:13})})]}),h.jsxs("div",{className:"canvas-inspector-macros","data-testid":"canvas-inspector-macros",children:[e&&h.jsxs(h.Fragment,{children:[h.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?"}),h.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"}),h.jsx("button",{className:"canvas-inspector-macro-btn btn-ghost","data-testid":"canvas-macro-explain",onClick:()=>l("Explain this step"),children:"Explain this step"})]}),h.jsxs("div",{className:"canvas-inspector-freeform",children:[h.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=>f(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&(m.preventDefault(),d())}}),h.jsx("button",{className:"btn-primary canvas-inspector-freeform-ask","data-testid":"canvas-freeform-ask",disabled:!c.trim(),onClick:d,children:"Ask"})]})]})]})}const Sb=24;function kT({overview:e,selectedNode:t,graph:i,run:r,workflows:o,onOpenWorkflow:c,onOpenSteps:f,onDeselect:l,onCollapse:d,onDescribeWithAI:m,describing:y=!1}){var ee;const v=z.useRef(null),S=z.useRef(null),w=z.useRef(null),R=z.useRef(null),x=z.useRef(dn().canvasInspectorHeight??null),[g,b]=z.useState(null),[p,_]=z.useState(!1),[k,A]=z.useState(!1),C=k||y;z.useEffect(()=>{y&&A(!1)},[y]),z.useEffect(()=>{if(!k)return;const W=window.setTimeout(()=>A(!1),8e3);return()=>window.clearTimeout(W)},[k]);const N=()=>{var Q;const W=(Q=v.current)==null?void 0:Q.parentElement;return W?Math.round(W.getBoundingClientRect().height*.5):Number.MAX_SAFE_INTEGER},j=()=>{var W;return(((W=S.current)==null?void 0:W.offsetHeight)??40)+1},M=z.useCallback(()=>{const W=S.current,Q=w.current,ie=R.current;if(!W||!Q||!ie)return;const I=N(),P=x.current,D=window.getComputedStyle(Q),H=(parseFloat(D.paddingTop)||0)+(parseFloat(D.paddingBottom)||0),U=W.offsetHeight+ie.offsetHeight+H+1,L=P!=null?Math.min(Math.max(P,j()),I):Math.min(U,I);b(L)},[]);z.useLayoutEffect(M),z.useEffect(()=>{var ie;if(typeof ResizeObserver>"u")return;const W=new ResizeObserver(M),Q=(ie=v.current)==null?void 0:ie.parentElement;return Q&&W.observe(Q),R.current&&W.observe(R.current),()=>W.disconnect()},[M]);const O=W=>{x.current=Math.round(Math.min(Math.max(W,j()),N())),M()},B=()=>{Kn({canvasInspectorHeight:x.current})},q=()=>{x.current=null,Kn({canvasInspectorHeight:null}),M()},V=W=>{if(W.button!==0)return;const Q=W.currentTarget,ie=v.current;if(!ie)return;try{Q.setPointerCapture(W.pointerId)}catch{}_(!0);const I=W.clientY,P=ie.getBoundingClientRect().height,D=U=>{O(P+(I-U.clientY))},H=()=>{_(!1),B(),window.removeEventListener("pointermove",D),window.removeEventListener("pointerup",H),window.removeEventListener("pointercancel",H)};window.addEventListener("pointermove",D),window.addEventListener("pointerup",H),window.addEventListener("pointercancel",H)},J=W=>{var ie;const Q=((ie=v.current)==null?void 0:ie.getBoundingClientRect().height)??0;W.key==="ArrowUp"?(W.preventDefault(),O(Q+Sb),B()):W.key==="ArrowDown"?(W.preventDefault(),O(Q-Sb),B()):W.key==="Home"&&(W.preventDefault(),q())};return h.jsxs("div",{ref:v,className:"canvas-overview"+(p?" is-resizing":"")+(t?" is-inspecting":""),"data-testid":"canvas-overview",style:g!=null?{height:g}:void 0,children:[h.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:V,onDoubleClick:q,onKeyDown:J}),h.jsx("div",{ref:S,className:"canvas-overview-head",children:t?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"canvas-step-dot dot--"+t.kind,"aria-hidden":"true"}),h.jsx("span",{className:"canvas-overview-title","data-testid":"canvas-inspector-title",children:t.label}),h.jsx("span",{className:"canvas-detail-kind node--"+t.kind,children:Yw(t.kind)}),h.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:f,children:["Open step ",h.jsx(de,{name:"ArrowRight",size:12})]}),h.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:h.jsx(de,{name:"X",size:13})})]}):h.jsxs(h.Fragment,{children:[h.jsx(de,{name:"Radio",size:13}),"Overview",h.jsx("button",{className:"theme-toggle canvas-overview-close","data-testid":"canvas-overview-toggle","aria-label":"Collapse agent overview","data-tooltip":"Collapse agent overview",onClick:d,children:h.jsx(de,{name:"X",size:13})})]})}),h.jsx("div",{ref:w,className:"canvas-overview-body",children:h.jsx("div",{ref:R,className:"canvas-overview-content",children:t&&i?h.jsx(CT,{graph:i,node:t,run:r,workflows:o,onOpenWorkflow:c}):e&&h.jsxs(h.Fragment,{children:[(e.stats||e.badges&&e.badges.length>0)&&h.jsxs("div",{className:"canvas-overview-meta","data-testid":"canvas-overview-meta",children:[e.stats&&h.jsx("span",{className:"canvas-overview-stats",children:e.stats}),(ee=e.badges)==null?void 0:ee.map(W=>h.jsx("span",{className:"canvas-overview-badge",children:W},W))]}),e.description&&h.jsx("p",{className:"canvas-overview-desc",children:e.description}),m&&h.jsx("button",{type:"button",className:"canvas-describe-ai"+(C?" is-loading":""),"data-testid":"canvas-describe-ai",disabled:C,"aria-busy":C,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.")||(A(!0),m())},"data-tooltip":"Runs a hidden coding-agent session that writes descriptions into the agent source — the canvas updates when it saves",children:C?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"canvas-describe-spinner","aria-hidden":"true"}),"Describing…"]}):h.jsxs(h.Fragment,{children:[h.jsx(de,{name:"Sparkles",size:13}),e.description?"Rewrite descriptions with AI":"Describe with AI"]})}),e.notes.length>0&&h.jsx("ul",{className:"canvas-overview-notes",children:e.notes.map(W=>h.jsx("li",{children:W},W))}),e.legend&&e.legend.length>0&&h.jsx("div",{className:"canvas-overview-legend","data-testid":"canvas-overview-legend",children:e.legend.map(W=>h.jsxs("span",{className:"canvas-overview-legend-item",children:[h.jsx("span",{className:"canvas-step-dot dot--"+W.kind,"aria-hidden":"true"}),W.label]},W.kind))})]})})})]})}function Zi({eyebrow:e,icon:t,title:i,body:r,cta:o,className:c,testId:f,children:l}){return h.jsxs("div",{className:"empty-state"+(c?` ${c}`:""),"data-empty-state":!0,"data-testid":f,children:[t&&h.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:h.jsx(de,{name:t,size:18})}),e&&h.jsx("span",{className:"empty-state-eyebrow",children:e}),h.jsx("span",{className:"empty-state-title",children:i}),r&&h.jsx("span",{className:"empty-state-body",children:r}),o&&h.jsx("span",{className:"empty-state-cta",children:o}),l]})}function Xv(e){return e.replace(/^@[^/]+\//,"").replace(/^example-/,"").trim()||e}function AT(e,t=Date.now()){const i=Math.max(0,Math.round((t-e)/1e3));if(i<45)return"just now";const r=Math.round(i/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 ox=Fw();function xo(e,{onDismiss:t,containerRef:i,triggerRef:r}){z.useEffect(()=>{if(!e)return;const o=f=>{var d;const l=i.current;!l||!(f.target instanceof Node)||l.contains(f.target)||(d=r==null?void 0:r.current)!=null&&d.contains(f.target)||t()},c=f=>{var l;f.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,i,r])}const bl=4,Ji=8;function jT(e,t,i,r,o){const c=e.getBoundingClientRect(),f={position:"fixed",top:"auto",right:"auto",bottom:"auto",left:"auto"};return o&&(f.overflowY="auto"),i&&(f.width=c.width),f.maxWidth=window.innerWidth-2*Ji,t.startsWith("right")?(f.left=(r??e).getBoundingClientRect().right+bl,t.endsWith("start")?(f.top=c.top,o&&(f.maxHeight=window.innerHeight-c.top-Ji)):(f.bottom=window.innerHeight-c.bottom,o&&(f.maxHeight=c.bottom-Ji)),f):(t.startsWith("down")?(f.top=c.bottom+bl,o&&(f.maxHeight=window.innerHeight-c.bottom-bl-Ji)):(f.bottom=window.innerHeight-c.top+bl,o&&(f.maxHeight=c.top-bl-Ji)),t.endsWith("start")?f.left=Math.max(Ji,c.left):f.right=Math.max(Ji,window.innerWidth-c.right),f)}function fn({open:e,anchorRef:t,onDismiss:i,placement:r,matchWidth:o=!1,besideRef:c,noClip:f=!1,className:l,role:d,testid:m,children:y}){const v=z.useRef(null),[S,w]=z.useState(null);xo(e,{onDismiss:i,containerRef:v,triggerRef:t});const R=z.useCallback(()=>{const x=t.current;x&&w(jT(x,r,o,(c==null?void 0:c.current)??null,!f))},[t,r,o,c,f]);return z.useLayoutEffect(()=>{e?R():w(null)},[e,R]),z.useLayoutEffect(()=>{if(!e||S==null)return;const x=v.current;if(!x)return;const g=x.getBoundingClientRect();let b=0;g.left<Ji?b=Ji-g.left:g.right>window.innerWidth-Ji&&(b=window.innerWidth-Ji-g.right),!(Math.abs(b)<.5)&&w(p=>p==null?p:{...p,left:typeof p.left=="number"?p.left+b:p.left,right:typeof p.right=="number"?p.right-b:p.right})},[e,S]),z.useEffect(()=>{if(e)return window.addEventListener("resize",R),window.addEventListener("scroll",R,!0),()=>{window.removeEventListener("resize",R),window.removeEventListener("scroll",R,!0)}},[e,R]),!e||S==null?null:ox.createPortal(h.jsx("div",{ref:v,className:l,role:d,"data-testid":m,style:S,children:y}),document.body)}function RT(e,t){return`${t?`${t} run`:"run"} ${e.status}`}function TT({workflow:e,detailStep:t,onBack:i,onAskAgent:r,surface:o,stepsSummary:c,run:f,runTarget:l,runs:d,onSelectRun:m}){const[y,v]=z.useState(!1),S=z.useRef(null),w=z.useCallback(()=>v(!1),[]),[R,x]=z.useState(!1),g=z.useRef(null),b=z.useCallback(()=>x(!1),[]);if(t)return h.jsxs("div",{className:"workflow-actions-header","data-testid":"workflow-actions-header",...$t({object:"run"}),children:[h.jsx("button",{className:"theme-toggle","data-testid":"canvas-detail-back",onClick:i,"aria-label":"Back to the steps list","data-tooltip":"Back to the steps list",children:h.jsx(de,{name:"ArrowLeft",size:14})}),h.jsx("span",{className:"workflow-actions-name","data-testid":"canvas-detail-title",children:t.label}),h.jsx("span",{className:"canvas-detail-kind node--"+t.kind,children:Yw(t.kind)}),h.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:[h.jsx(de,{name:"MessageSquare",size:13}),h.jsx("span",{className:"canvas-detail-ask-label",children:"Ask coding agent"})]}),h.jsxs("div",{className:"canvas-detail-menu-wrap",children:[h.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":y,onClick:()=>v(p=>!p),children:h.jsx(de,{name:"MoreHorizontal",size:14})}),h.jsxs(fn,{open:y,anchorRef:S,onDismiss:w,placement:"down-end",className:"canvas-detail-menu",role:"menu",testid:"canvas-detail-menu-popover",children:[h.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.`),w()},children:[h.jsx(de,{name:"Wand2",size:13}),"Ask coding agent to modify"]}),h.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{var p;(p=navigator.clipboard)==null||p.writeText(t.label).catch(()=>{}),w()},children:[h.jsx(de,{name:"Copy",size:13}),"Copy step name"]})]})]})]});if(o==="steps"){const p=f&&h.jsxs(h.Fragment,{children:[f.status==="running"&&h.jsx("span",{className:"canvas-run-status is-running","aria-hidden":"true"}),RT(f,l)]});return h.jsxs("div",{className:"workflow-actions-header"+(f?" has-run":""),"data-testid":"workflow-actions-header",...$t({object:"agent"}),children:[h.jsx("span",{className:"workflow-actions-name",title:e.name,children:Xv(e.name)}),h.jsx("span",{className:"workflow-actions-count","data-testid":"canvas-steps-count",children:c??"no steps"}),f&&d.length<=1&&h.jsx("span",{className:"status-tag canvas-run-chip is-"+f.status,"data-testid":"canvas-run-chip",children:p}),f&&d.length>1&&h.jsxs("div",{className:"canvas-run-picker-wrap",children:[h.jsxs("button",{ref:g,className:"status-tag status-tag-action canvas-run-chip canvas-run-chip--picker is-"+f.status,"data-testid":"canvas-run-chip","aria-haspopup":"menu","aria-expanded":R,"aria-label":`Pick a run to inspect (${d.length} observed)`,"data-tooltip":"Pick a run to inspect",onClick:()=>x(_=>!_),children:[p,h.jsx(de,{name:"ChevronDown",size:12})]}),h.jsx(fn,{open:R,anchorRef:g,onDismiss:b,placement:"down-end",className:"canvas-run-menu",role:"menu",testid:"canvas-run-menu",children:[...d].reverse().map((_,k)=>{const A=d.length-k,C=_.run.executionId===f.executionId,N=AT(_.observedAt);return h.jsxs("button",{role:"menuitemradio","aria-checked":C,className:"profile-menu-item"+(C?" is-selected":""),"data-testid":`canvas-run-option-${_.run.executionId}`,title:_.run.executionId,onClick:()=>{m(_.run.executionId),b()},children:[h.jsx(de,{name:C?"Check":"Play",size:13}),h.jsx("span",{children:`run ${A} · ${_.run.status} · ${_.target}`}),h.jsx("span",{className:"canvas-run-option-meta",children:N})]},_.run.executionId)})})]})]})}return null}const ia=[{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 NT(e){return e.map((t,i)=>({step:t,index:i})).sort((t,i)=>{const r=t.step.startedAt?Date.parse(t.step.startedAt):Number.NaN,o=i.step.startedAt?Date.parse(i.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-i.index}).map(({step:t})=>t)}function MT(e){return e==="completed"?"Completed":e==="failed"?"Failed":e==="cancelled"?"Cancelled":"Running"}function DT(e){return e==="prod"?"Cloud":e==="local"?"Local":"Run"}function OT(e){if(e.startedAt&&e.finishedAt){const i=Date.parse(e.startedAt),r=Date.parse(e.finishedAt);if(Number.isFinite(i)&&Number.isFinite(r)&&r>=i)return r-i}const t=e.steps.reduce((i,r)=>i+(r.latencyMs??0),0);return t>0?t:null}function lx({status:e}){return e==="passed"?h.jsx(de,{name:"Check",size:11}):e==="failed"?h.jsx(de,{name:"X",size:11}):e==="running"?h.jsx("span",{className:"run-workspace-pulse"}):h.jsx("span",{className:"run-workspace-pending"})}function $T(e,t){if(!e.startedAt||!t.startedAt)return{left:0,width:e.latencyMs?100:12};const i=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![i,r,o,c].every(Number.isFinite)||o<=i?{left:0,width:e.latencyMs?100:12}:{left:Math.max(0,Math.min(96,(r-i)/(o-i)*100)),width:Math.max(4,Math.min(100,(c-r)/(o-i)*100))}}function wb({attempts:e,run:t,selectedId:i,onSelect:r}){const o=z.useRef([]);return h.jsxs("div",{className:"run-timeline",role:"listbox","aria-label":"Execution attempts","data-testid":"run-timeline",children:[h.jsxs("div",{className:"run-timeline-title",children:["Attempts ",h.jsx("span",{children:e.length})]}),e.map((c,f)=>{const l=$T(c,t);return h.jsxs("button",{ref:d=>{o.current[f]=d},type:"button",role:"option","aria-selected":i===c.id,tabIndex:i===c.id||i===null&&f===0?0:-1,className:"run-timeline-row","data-testid":`run-attempt-${c.id}`,"data-status":c.status,onClick:()=>r(c),onKeyDown:d=>{var y;if(!["ArrowDown","ArrowUp","Home","End"].includes(d.key))return;d.preventDefault();const m=d.key==="Home"?0:d.key==="End"?e.length-1:(f+(d.key==="ArrowDown"?1:-1)+e.length)%e.length;(y=o.current[m])==null||y.focus(),r(e[m])},children:[h.jsx("span",{className:"run-timeline-index",children:String(f+1).padStart(2,"0")}),h.jsx("span",{className:"run-timeline-status","aria-label":c.status,children:h.jsx(lx,{status:c.status})}),h.jsxs("span",{className:"run-timeline-copy",children:[h.jsx("strong",{children:c.name}),h.jsxs("small",{children:["Attempt ",c.attempt??1]})]}),h.jsx("span",{className:"run-timeline-duration",children:c.latencyMs!==void 0?Yn(c.latencyMs):c.status}),h.jsx("span",{className:"run-timeline-track","aria-hidden":"true",children:h.jsx("span",{style:{left:`${l.left}%`,width:`${l.width}%`}})})]},c.id)})]})}function LT(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 IT({step:e,tab:t}){var r,o;const i=LT(e,t);return i===void 0||t==="calls"&&Array.isArray(i)&&i.length===0?h.jsxs("div",{className:"run-evidence-empty",children:[h.jsx(de,{name:"Info",size:14})," ",(r=ia.find(c=>c.id===t))==null?void 0:r.label," not recorded."]}):t==="calls"&&Array.isArray(i)?h.jsx("div",{className:"run-call-list",children:i.map((c,f)=>h.jsxs("article",{className:"run-call",children:[h.jsxs("header",{children:[h.jsx("code",{children:c.capability}),c.stubUsed&&h.jsx("span",{children:"stubbed"})]}),h.jsxs("div",{className:"run-call-pair",children:[h.jsx("section",{children:c.args===void 0?h.jsx("p",{children:"Arguments not recorded."}):h.jsx(ql,{value:c.args,label:"Arguments",testId:`run-call-arguments-${f}`,defaultOpen:!1})}),h.jsx("section",{children:c.result===void 0?h.jsx("p",{children:"Result not recorded."}):h.jsx(ql,{value:c.result,label:"Result",testId:`run-call-result-${f}`,defaultOpen:!1})})]})]},`${c.capability}-${f}`))}):t==="input"||t==="output"||t==="state"||t==="directive"||t==="logs"?h.jsx(ql,{value:i,label:(o=ia.find(c=>c.id===t))==null?void 0:o.label,testId:"run-evidence-artifact"}):h.jsx("div",{className:"run-evidence-empty",children:"Evidence not recorded."})}function PT(e,t){var r;const i=(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:i}},null,2)}function xb({run:e,step:t,tab:i,onTab:r,onBack:o,onAskAgent:c}){const f=z.useRef([]),l=z.useId(),d=`${l}-panel`;return h.jsxs("section",{className:"run-attempt-inspector","aria-label":`${t.name} attempt ${t.attempt??1}`,...$t({object:"run"}),children:[h.jsxs("header",{className:"run-attempt-head",children:[h.jsxs("button",{type:"button",className:"btn-ghost run-attempt-back",onClick:o,children:[h.jsx(de,{name:"ArrowLeft",size:13})," Back"]}),h.jsxs("div",{children:[h.jsx("h3",{children:t.name}),h.jsxs("p",{children:[h.jsx("span",{"data-status":t.status,children:t.status})," · Attempt"," ",t.attempt??1,t.latencyMs!==void 0?` · ${Yn(t.latencyMs)}`:""]})]}),h.jsxs("button",{type:"button",className:"btn-ghost run-attempt-debug",onClick:()=>c(`Help me inspect and improve this execution attempt.
452
+
453
+ ${PT(e,t)}`),children:[h.jsx(de,{name:"MessageSquare",size:13})," Ask coding agent"]})]}),t.error&&h.jsxs("div",{className:"run-attempt-error",children:[h.jsx(de,{name:"TriangleAlert",size:14}),h.jsx("span",{children:t.error})]}),h.jsx("div",{className:"run-evidence-tabs",role:"tablist","aria-label":"Attempt evidence",children:ia.map((m,y)=>h.jsx("button",{ref:v=>{f.current[y]=v},type:"button",role:"tab",id:`${l}-${m.id}`,"aria-selected":i===m.id,"aria-controls":d,tabIndex:i===m.id?0:-1,"data-testid":`run-evidence-tab-${m.id}`,onClick:()=>r(m.id),onKeyDown:v=>{var w;if(!["ArrowLeft","ArrowRight","Home","End"].includes(v.key))return;v.preventDefault();const S=v.key==="Home"?0:v.key==="End"?ia.length-1:(y+(v.key==="ArrowRight"?1:-1)+ia.length)%ia.length;r(ia[S].id),(w=f.current[S])==null||w.focus()},children:m.label},m.id))}),h.jsx("div",{className:"run-evidence-panel",id:d,role:"tabpanel","aria-labelledby":`${l}-${i}`,children:h.jsx(IT,{step:t,tab:i})})]})}function BT({run:e}){const t=e.unusedStubs??[],i=e.stubWarnings??[];return t.length===0&&i.length===0?null:h.jsxs("details",{className:"run-stub-notices","data-testid":"run-stub-notices",children:[h.jsxs("summary",{children:["Stub notices ",h.jsx("span",{children:t.length+i.length})]}),t.length>0&&h.jsxs("section",{children:[h.jsx("h4",{children:"Unused stubs"}),h.jsx("ul",{children:t.map(r=>h.jsxs("li",{children:[h.jsx("code",{children:r.step})," · ",r.key]},`${r.step}:${r.key}`))})]}),i.length>0&&h.jsxs("section",{children:[h.jsx("h4",{children:"Warnings"}),h.jsx("ul",{children:i.map((r,o)=>h.jsx("li",{children:r},o))})]})]})}function HT(e){if(e.output!==void 0)return{value:e.output,label:"Result"};const t=[...e.steps].reverse().find(i=>i.status==="passed"&&i.output!==void 0);return t?{value:t.output,label:"Latest output"}:null}function Cb({run:e,target:t,workflow:i,focus:r,onToggleFocus:o,onAskAgent:c,onInspectionOpened:f,onArtifactViewed:l,onDashboardOpened:d}){const m=z.useMemo(()=>NT(e.steps),[e.steps]),[y,v]=z.useState(null),[S,w]=z.useState("output"),R=z.useRef(!1),x=z.useRef(null),g=z.useRef(null),b=z.useRef(null),p=m.find(j=>j.id===y)??null,_=HT(e),k=OT(e);z.useEffect(()=>{R.current=!1,x.current=null,v(null),w("output")},[e.executionId]),z.useEffect(()=>{if(!(R.current||e.status==="running"))if(e.status==="failed"){const j=[...m].reverse().find(M=>M.status==="failed");j&&(v(j.id),w("logs"))}else e.status==="completed"&&v(null)},[e.status,m]),z.useEffect(()=>{if(!r||typeof document>"u")return;const j=document.getElementById("root");g.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const M=(j==null?void 0:j.getAttribute("aria-hidden"))??null,O=(j==null?void 0:j.inert)??!1;j&&(j.inert=!0,j.setAttribute("aria-hidden","true"));const B=window.requestAnimationFrame(()=>{var q;return(q=b.current)==null?void 0:q.focus()});return()=>{var q;window.cancelAnimationFrame(B),j&&(j.inert=O,M===null?j.removeAttribute("aria-hidden"):j.setAttribute("aria-hidden",M)),(q=g.current)==null||q.focus(),g.current=null}},[r]),z.useEffect(()=>{if(!r)return;const j=M=>{M.key==="Escape"&&(M.preventDefault(),M.stopImmediatePropagation(),y!==null?v(null):o())};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[r,y,o]);const A=j=>{R.current=!0,v(j.id),w(j.status==="failed"?"logs":"output"),f==null||f()},C=h.jsxs("section",{className:"run-overview",children:[!r&&h.jsx(wb,{attempts:m,run:e,selectedId:y,onSelect:A}),_?h.jsx(ql,{value:_.value,label:_.label,viewEventKey:e.executionId,onViewed:()=>{x.current!==e.executionId&&(x.current=e.executionId,l==null||l())}}):e.status==="running"?h.jsxs("div",{className:"run-result-pending",children:[h.jsx("span",{className:"run-workspace-pulse"})," Waiting for the agent result…"]}):e.error!==void 0?h.jsxs("div",{className:"run-result-error",children:[h.jsx(de,{name:"TriangleAlert",size:15}),h.jsx("pre",{children:Zw(e.error)})]}):h.jsx("div",{className:"run-result-pending",children:"No result was recorded."}),h.jsx(BT,{run:e})]}),N=h.jsxs("div",{className:"run-workspace"+(r?" is-focus":""),"data-testid":"run-workspace",children:[h.jsxs("header",{className:"run-workspace-header",children:[h.jsxs("span",{className:"run-workspace-status","data-status":e.status,children:[h.jsx(lx,{status:e.status==="completed"?"passed":e.status==="failed"||e.status==="cancelled"?"failed":"running"}),MT(e.status)]}),k!==null&&h.jsx("span",{children:Yn(k)}),h.jsx("span",{children:DT(t)}),h.jsx("span",{className:"run-workspace-spacer"}),(i==null?void 0:i.definitionId)!=null&&h.jsxs("a",{href:xh(i.definitionId),target:"_blank",rel:"noreferrer",onClick:d,children:[h.jsx(de,{name:"Cloud",size:12})," Dashboard"]}),r&&h.jsx("button",{ref:b,type:"button",className:"theme-toggle",onClick:o,"aria-label":"Exit Focus mode",children:h.jsx(de,{name:"Minimize2",size:14})})]}),r?h.jsxs("div",{className:"run-workspace-focus-grid",children:[h.jsx(wb,{attempts:m,run:e,selectedId:y,onSelect:A}),h.jsx("div",{className:"run-workspace-inspector",children:p?h.jsx(xb,{run:e,step:p,tab:S,onTab:w,onBack:()=>v(null),onAskAgent:c}):C})]}):p?h.jsx(xb,{run:e,step:p,tab:S,onTab:w,onBack:()=>v(null),onAskAgent:c}):C]});return r&&typeof document<"u"?ox.createPortal(h.jsx("div",{className:"run-focus-layer","data-testid":"run-focus-layer",role:"dialog","aria-modal":"true","aria-label":"Execution Focus mode",children:N}),document.body):N}var _e=typeof window<"u"?window:void 0,Zs=typeof globalThis<"u"?globalThis:_e,ai=Zs==null?void 0:Zs.navigator,Ie=Zs==null?void 0:Zs.document,ws=Zs==null?void 0:Zs.location,Jv=Zs==null?void 0:Zs.fetch,Vm=Zs!=null&&Zs.XMLHttpRequest&&"withCredentials"in new Zs.XMLHttpRequest?Zs.XMLHttpRequest:void 0,Eb=Zs==null?void 0:Zs.AbortController,zT=Zs==null?void 0:Zs.CompressionStream,mi=ai==null?void 0:ai.userAgent;function cx(){return!(!_e||_e.navigator.onLine===!1)}var Sl=typeof globalThis<"u"?globalThis:_e;Sl&&typeof self>"u"&&(Sl.self=Sl),Sl&&typeof File>"u"&&(Sl.File=function(){});var Ge=_e??{},Bt={DEBUG:!1,LIB_VERSION:"0.3.1",LIB_NAME:"browser-common"};function kb(e,t,i,r,o,c,f){try{var l=e[c](f),d=l.value}catch(m){return void i(m)}l.done?t(d):Promise.resolve(d).then(r,o)}function rs(e){return function(){var t=this,i=arguments;return new Promise((function(r,o){var c=e.apply(t,i);function f(d){kb(c,r,o,f,l,"next",d)}function l(d){kb(c,r,o,f,l,"throw",d)}f(void 0)}))}}function Re(){return Re=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},Re.apply(null,arguments)}function ux(e,t){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;i[r]=e[r]}return i}var Ab=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function jb(e){return typeof e=="string"||e}function Rb(e){return typeof e=="string"?e:void 0}var wl,UT=["$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"],zn=(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})({}),Tb=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),qT=["$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"],FT=["token"],dx="NativeGzipValidationError",Wm=e=>e.length>=2&&e[0]===31&&e[1]===139,Nb=(e,t)=>e===Tb.GZipJS||t===Tb.GZipJS||t==="gzip",Mb=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",bu=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=dx,t},VT=(function(){var e=rs((function*(t,i){18>t.size&&bu("too-short");var r=new Uint8Array(yield t.slice(0,10).arrayBuffer());Wm(r)&&r[2]===8||bu("invalid-header");var o=new DataView(yield t.slice(t.size-8).arrayBuffer());o.getUint32(0,!0)!==(f=>{for(var l=(()=>{if(wl)return wl;wl=[];for(var y=0;256>y;y++){for(var v=y,S=0;8>S;S++)v=1&v?3988292384^v>>>1:v>>>1;wl[y]=v>>>0}return wl})(),d=4294967295,m=0;f.length>m;m++)d=l[255&(d^f[m])]^d>>>8;return(4294967295^d)>>>0})(i)&&bu("invalid-crc");var c=i.length>>>0;o.getUint32(4,!0)!==c&&bu("invalid-size")}));return function(t,i){return e.apply(this,arguments)}})();function Gm(){return Gm=rs((function*(e,t,i){t===void 0&&(t=!0);try{var r=new TextEncoder().encode(e),o=new globalThis.CompressionStream("gzip"),c=o.writable.getWriter(),f=c.write(r).then((()=>c.close())).catch((function(){var m=rs((function*(y){try{yield c.abort(y)}catch{}throw y}));return function(y){return m.apply(this,arguments)}})()),l=new Response(o.readable).blob(),d=(yield Promise.all([l,f]))[0];return yield VT(d,r),d}catch(m){if(i!=null&&i.rethrow)throw m;return t&&console.error("Failed to gzip compress data",m),null}})),Gm.apply(this,arguments)}var WT=["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"],Db=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var i=e.toLowerCase();return WT.concat(t).some((r=>{var o=r.toLowerCase();return i.indexOf(o)!==-1}))};function st(e,t){return e.indexOf(t)!==-1}var Ch=function(e){return e.trim()},Km=function(e){return e.replace(/^\$/,"")};function hx(e){var t,i=[];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(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(o))return"[Circular]";i.push(o)}return o}})))!==null&&t!==void 0?t:"null"}var fx=Object.prototype,px=fx.hasOwnProperty,Eh=fx.toString,rt=Array.isArray||function(e){return Eh.call(e)==="[object Array]"},Ri=e=>typeof e=="function",ns=e=>e===Object(e)&&!rt(e),Sr=e=>{if(ns(e)){for(var t in e)if(px.call(e,t))return!1;return!0}return!1},Me=e=>e===void 0,Kt=e=>Eh.call(e)=="[object String]",Ym=e=>Kt(e)&&e.trim().length===0,oi=e=>e===null,lt=e=>Me(e)||oi(e),Gs=e=>Eh.call(e)=="[object Number]"&&e==e,Bn=e=>Gs(e)&&e>0,Qi=e=>Eh.call(e)==="[object Boolean]",GT=e=>e instanceof FormData,KT=e=>st(qT,e),YT=e=>st(FT,e);function mx(e){return e===null||typeof e!="object"}function Wd(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Zv(e){return typeof Event<"u"&&(function(t,i){try{return t instanceof i}catch{return!1}})(e,Event)}var XT=[!0,"true",1,"1","yes"],Vp=e=>st(XT,e),JT=[!1,"false",0,"0","no"];function hn(e,t,i,r,o){return t>i&&(r.warn("min cannot be greater than max."),t=i),Gs(e)?e>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):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: "+i+", fallback: "+o),hn(o||i,t,i,r))}class ZT{constructor(t){this.tt={},this.et=t.et,this.rt=hn(t.bucketSize,0,100,t.it),this.nt=hn(t.refillRate,0,this.rt,t.it),this.st=hn(t.refillInterval,0,864e5,t.it)}ot(t,i){var r=Math.floor((i-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 i,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&&((i=this.et)==null||i.call(this,t)),c.tokens===0)}stop(){this.tt={}}}var Mi="Mobile",Gd="iOS",Wn="Android",vo="Tablet",vx=Wn+" "+vo,gx="iPad",_x="Apple",yx=_x+" Watch",Fl="Safari",go="BlackBerry",bx="Samsung",Sx=bx+"Browser",wx=bx+" Internet",oa="Chrome",QT=oa+" OS",xx=oa+" "+Gd,Qv="Internet Explorer",Cx=Qv+" "+Mi,eg="Opera",e3=eg+" Mini",tg="Edge",Ex="Microsoft "+tg,uo="Firefox",kx=uo+" "+Gd,Jl="Nintendo",Zl="PlayStation",ho="Xbox",Ax=Wn+" "+Mi,jx=Mi+" "+Fl,Il="Windows",Xm=Il+" Phone",Ob="Nokia",Jm="Ouya",Rx="Generic",t3=Rx+" "+Mi.toLowerCase(),Tx=Rx+" "+vo.toLowerCase(),Zm="Konqueror",Nx="Oculus Browser",Kd="Vivaldi",Mx="Yandex",Yd="Whale",Qm="DuckDuckGo",Dx="Pale Moon",Xd="Waterfox",Vl="Brave",Ox="Google Search App",cs="(\\d+(\\.\\d+)?)",Wp=new RegExp("Version/"+cs),s3=new RegExp(ho,"i"),i3=new RegExp(Zl+" \\w+","i"),n3=new RegExp(Jl+" \\w+","i"),sg=new RegExp(go+"|PlayBook|BB10","i"),r3={"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"},$x=function(e,t,i,r){t=t||"";var o=(function(c){return c!=null&&c.brave?Vl:null})(i);return o||(r!=null&&r.detectGoogleSearchApp&&st(e,"GSA/")?Ox:st(e," OPR/")&&st(e,"Mini")?e3:st(e," OPR/")?eg:sg.test(e)?go:st(e,"IE"+Mi)||st(e,"WPDesktop")?Cx:st(e,"OculusBrowser")?Nx:st(e,Sx)?wx:st(e,tg)||st(e,"Edg/")?Ex:st(e,Kd+"/")?Kd:st(e,"YaBrowser/")?Mx:st(e,Yd+"/")?Yd:st(e,Qm+"/")||st(e,"Ddg/")?Qm:st(e,"FBIOS")?"Facebook "+Mi:st(e,"UCWEB")||st(e,"UCBrowser")?"UC Browser":st(e,"CriOS")?xx:st(e,"CrMo")||st(e,oa)?oa:st(e,Wn)&&st(e,Fl)?Ax:st(e,"FxiOS")?kx:st(e.toLowerCase(),Zm.toLowerCase())?Zm:st(e,Vl+"/")?Vl:((c,f)=>f&&st(f,_x)||(function(l){return st(l,Fl)&&!st(l,oa)&&!st(l,Wn)})(c))(e,t)?st(e,Mi)?jx:Fl:st(e,"PaleMoon/")?Dx:st(e,Xd+"/")?Xd:st(e,uo)?uo:st(e,"MSIE")||st(e,"Trident/")?Qv:st(e,"Gecko")?uo:"")},a3={[Cx]:[new RegExp("rv:"+cs)],[Ex]:[new RegExp(tg+"?\\/"+cs)],[oa]:[new RegExp("("+oa+"|CrMo)\\/"+cs)],[xx]:[new RegExp("CriOS\\/"+cs)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+cs)],[Fl]:[Wp],[jx]:[Wp],[eg]:[new RegExp("(Opera|OPR)\\/"+cs)],[uo]:[new RegExp(uo+"\\/"+cs)],[kx]:[new RegExp("FxiOS\\/"+cs)],[Zm]:[new RegExp("Konqueror[:/]?"+cs,"i")],[go]:[new RegExp(go+" "+cs),Wp],[Ax]:[new RegExp("android\\s"+cs,"i")],[wx]:[new RegExp(Sx+"\\/"+cs)],[Nx]:[new RegExp("OculusBrowser\\/"+cs)],[Kd]:[new RegExp(Kd+"\\/"+cs)],[Mx]:[new RegExp("YaBrowser\\/"+cs)],[Yd]:[new RegExp(Yd+"\\/"+cs)],[Vl]:[new RegExp(Vl+"\\/"+cs)],[Qm]:[new RegExp("(DuckDuckGo|Ddg)\\/"+cs)],[Dx]:[new RegExp("PaleMoon\\/"+cs)],[Xd]:[new RegExp(Xd+"\\/"+cs)],[Ox]:[new RegExp("GSA\\/"+cs)],[Qv]:[new RegExp("(rv:|MSIE )"+cs)],Mozilla:[new RegExp("rv:"+cs)]},o3=function(e,t,i,r){var o=$x(e,t,i,r),c=a3[o];if(Me(c))return null;for(var f=0;c.length>f;f++){var l=e.match(c[f]);if(l)return parseFloat(l[l.length-2])}return null},$b=[[new RegExp(ho+"; "+ho+" (.*?)[);]","i"),e=>[ho,e&&e[1]||""]],[new RegExp(Jl,"i"),[Jl,""]],[new RegExp(Zl,"i"),[Zl,""]],[sg,[go,""]],[new RegExp(Il,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Xm,""];if(new RegExp(Mi).test(t)&&!/IEMobile\b/.test(t))return[Il+" "+Mi,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=r3[i[1]]||"";return/arm/i.test(t)&&(r="RT"),[Il,r]}return[Il,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Gd,[e[3],e[4],e[5]||"0"].join(".")]:[Gd,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Me(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Wn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Wn+")","i"),e=>e&&e[2]?[Wn,[e[2],e[3],e[4]||"0"].join(".")]:[Wn,""]],[/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/,[QT,""]],[/Linux|debian/i,["Linux",""]]],Lb=function(e){return n3.test(e)?Jl:i3.test(e)?Zl:s3.test(e)?ho:new RegExp(Jm,"i").test(e)?Jm:new RegExp("("+Xm+"|WPDesktop)","i").test(e)?Xm:/iPad/.test(e)?gx:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?yx:sg.test(e)?go:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Ob,"i").test(e)?Ob:/(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(Mi).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)?Wn:vx:new RegExp("(pda|"+Mi+")","i").test(e)?t3:new RegExp(vo,"i").test(e)&&!new RegExp(vo+" pc","i").test(e)?Tx:""},l3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ib(e,t){return typeof(i=e)=="string"&&l3.test(i)?e:t();var i}function xr(e){return e&&e.split("#")[0]}function Od(e,t){var i=setTimeout(e,t);return i!=null&&i.unref&&(i==null||i.unref()),i}var c3=e=>e instanceof Error,Lx={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}},u3=Lx.info;function Ix(e){if(Qi(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(rt(e))return{arrayValue:{values:e.map((t=>Ix(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function Jd(e){var t=[];for(var i in e){var r=e[i];oi(r)||Me(r)||t.push({key:i,value:Ix(r)})}return t}function d3(e,t){var i=Lx[e.level||"info"]||u3,r=i.text,o=i.number,c=String(Date.now())+"000000",f={};t.distinctId&&(f.posthogDistinctId=t.distinctId),t.sessionId&&(f.sessionId=t.sessionId),t.windowId&&(f["window.id"]=t.windowId),lt(t.sessionStartTimestamp)||(f.sessionStartTimestamp=String(t.sessionStartTimestamp)),lt(t.lastActivityTimestamp)||(f.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(f["url.full"]=t.currentUrl),t.screenName&&(f["screen.name"]=t.screenName),t.appState&&(f["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(f.feature_flags=t.activeFeatureFlags);var l=Re({},f,e.attributes||{}),d={timeUnixNano:c,observedTimeUnixNano:c,severityNumber:o,severityText:r,body:{stringValue:e.body},attributes:Jd(l)};return e.trace_id&&(d.traceId=e.trace_id),e.span_id&&(d.spanId=e.span_id),Me(e.trace_flags)||(d.flags=e.trace_flags),d}function Px(e,t,i){return Re({},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":i})}function Bx(e,t,i,r){return{resourceLogs:[{resource:{attributes:Jd(t)},scopeLogs:[{scope:{name:i,version:r},logRecords:e}]}]}}let h3=class{constructor(e,t,i,r,o,c,f){var l;c===void 0&&(c=()=>Promise.resolve()),this._instance=e,this.Te=t,this.it=i,this.ut=r,this.ht=o,this.dt=c,this.ct=f,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 i={record:d3(t,this.ut())};this.ht((()=>this.Ot(i)))}}else this.it.info("Log was rejected in beforeSend function")}}Rt(e){var t=this.Te.beforeSend;if(!t)return e;var i=rt(t)?t:[t],r=e;for(var o of i)try{var c=o(r);if(!c)return this.it.info("Log was rejected in beforeSend function"),null;r=c}catch(f){return this.it.error("Error in beforeSend function for log:",f),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 rs((function*(){if(!e._instance.isDisabled)return e.vt||(e.vt=e.Ft().finally((()=>{e.vt=null}))),e.vt}))()}Ft(){var e=this;return rs((function*(){var t;e.Tt();var i=(t=e._instance.getPersistedProperty(zn.LogsQueue))!==null&&t!==void 0?t:[];if(i.length!==0)for(var r=i.length,o=0;i.length>0&&r>o;){var c,f;e.ft=0;var l=Math.min(i.length,e.Ct),d=i.slice(0,l),m=Bx(d.map((v=>v.record)),e.At(),(c=e.ct)!==null&&c!==void 0?c:e._instance.getLibraryId(),e._instance.getLibraryVersion()),y=yield e._instance.$t(m);if(y.kind==="too-large"&&d.length>1)e.Ct=Math.max(1,Math.floor(d.length/2)),e.it.warn("Received 413 when sending logs batch of size "+d.length+", reducing batch size to "+e.Ct);else if(y.kind==="retry-later"||(y.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."):y.kind==="ok"&&e.Te.maxBatchRecordsPerPost>e.Ct&&(e.Ct=Math.min(e.Te.maxBatchRecordsPerPost,e.Ct+1)),yield e.Lt(d.length),i=(f=e._instance.getPersistedProperty(zn.LogsQueue))!==null&&f!==void 0?f:[],o+=d.length,y.kind==="fatal"))throw y.error}}))()}Lt(e){var t=this;return rs((function*(){var i,r=Math.max(0,e-t.ft),o=(i=t._instance.getPersistedProperty(zn.LogsQueue))!==null&&i!==void 0?i:[];t._instance.setPersistedProperty(zn.LogsQueue,o.slice(r)),yield t.dt()}))()}At(){return Px(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ot(e){var t;if(!this._instance.optedOut){var i=(t=this._instance.getPersistedProperty(zn.LogsQueue))!==null&&t!==void 0?t:[];this.kt>i.length||(i.shift(),this.ft++,this.it.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(zn.LogsQueue,i),this.xt>i.length?this.Dt():this.Et()}}Dt(e){e===void 0&&(e=this.St),this.Nt||(this.Nt=Od((()=>{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(zn.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return rs((function*(){t.Tt();var i=t.flush().catch((()=>{}));e!==void 0?yield Promise.race([i,new Promise((r=>Od(r,e)))]):yield i}))()}flushWithTimeout(e){var t=this;return rs((function*(){var i=!1,r=t.flush(),o=new Promise((c=>Od((()=>{i=!0,c()}),e)));try{yield Promise.race([r,o])}finally{i&&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 Gp=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Pb(e){return String(e)+"000000"}function Bb(e,t,i,r){var o="";return r&&(o=Object.keys(r).sort().map((c=>JSON.stringify(c)+":"+JSON.stringify(r[c]))).join(",")),e+"\0"+t+"\0"+(i??"")+"\0"+o}let f3=class{constructor(e,t,i){this._instance=e,this.Te=t,this.it=i,this.Bt=new Map,this.vt=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Vt=0}count(e,t,i){t===void 0&&(t=1),this.Wt({name:e,type:"count",value:t,unit:i==null?void 0:i.unit,attributes:i==null?void 0:i.attributes})}gauge(e,t,i){this.Wt({name:e,type:"gauge",value:t,unit:i==null?void 0:i.unit,attributes:i==null?void 0:i.attributes})}histogram(e,t,i){this.Wt({name:e,type:"histogram",value:t,unit:i==null?void 0:i.unit,attributes:i==null?void 0:i.attributes})}flush(){var e=this,t=this.vt,i=(function(){var o=rs((function*(){t&&(yield t.catch((()=>{}))),yield e.Zt()}));return function(){return o.apply(this,arguments)}})(),r=i().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 i,r;try{i=t.attributes?Re({},t.attributes):void 0,r=Bb(t.type,t.name,t.unit,i)}catch(f){return void this.it.warn("Dropping metric '"+t.name+"': attributes could not be serialized",f)}var o=this.Bt.get(r);if(!o){if(!this.Qt())return;o={name:t.name,type:t.type,unit:t.unit,attributes:i,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 i;switch(e.type){case"count":e.total=((i=e.total)!==null&&i!==void 0?i: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(Gp.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 f=0;c.length>f;f++)if(c[f]>=o)return f;return c.length})(t,Gp)]+=1}}Rt(e){var t=this.Te.beforeSend;if(!t)return e;var i=rt(t)?t:[t],r=e;for(var o of i)try{var c=o(r);if(!c)return this.it.info("Metric was rejected in beforeSend function"),null;r=c}catch(f){return this.it.error("Error in beforeSend function for metric:",f),null}return r}Dt(){this.Nt||(this.Nt=Od((()=>{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 rs((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 i=e.Vt,r=yield e._instance.Kt(e.Gt(t));if(i===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),i=(function(c,f,l){return Re({},c.resourceAttributes,{"service.name":c.serviceName||"unknown_service"},c.environment&&{"deployment.environment":c.environment},c.serviceVersion&&{"service.version":c.serviceVersion},{"telemetry.sdk.name":f,"telemetry.sdk.version":l})})(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),o=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Jd(i)},scopeMetrics:[{scope:{name:r,version:o},metrics:t}]}]};var t,i,r,o}Xt(e){var t=Pb(Date.now()),i=new Map;for(var r of e.values()){var o,c=Bb(r.type,r.name,r.unit,void 0),f=i.get(c);f||(f=Re({name:r.name},r.unit&&{unit:r.unit}),r.type==="count"?f.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:r.type==="gauge"?f.gauge={dataPoints:[]}:f.histogram={aggregationTemporality:1,dataPoints:[]},i.set(c,f));var l=Jd((o=r.attributes)!==null&&o!==void 0?o:{}),d=Pb(r.windowStartMs);if(r.type==="count"){var m,y={attributes:l,startTimeUnixNano:d,timeUnixNano:t,asDouble:(m=r.total)!==null&&m!==void 0?m:0};f.sum.dataPoints.push(y)}else if(r.type==="gauge"){var v,S={attributes:l,timeUnixNano:t,asDouble:(v=r.last)!==null&&v!==void 0?v:0};f.gauge.dataPoints.push(S)}else r.hist&&f.histogram.dataPoints.push({attributes:l,startTimeUnixNano:d,timeUnixNano:t,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:Gp})}return Array.from(i.values())}Yt(e){var t,i;for(var r of e){var o=r[0],c=r[1],f=this.Bt.get(o);if(f)switch(f.windowStartMs=Math.min(f.windowStartMs,c.windowStartMs),f.type){case"count":f.total=((t=f.total)!==null&&t!==void 0?t:0)+((i=c.total)!==null&&i!==void 0?i:0);break;case"gauge":break;case"histogram":if(c.hist)if(f.hist){f.hist.count+=c.hist.count,f.hist.sum+=c.hist.sum,f.hist.min=Math.min(f.hist.min,c.hist.min),f.hist.max=Math.max(f.hist.max,c.hist.max);for(var l=0;f.hist.bucketCounts.length>l;l++)f.hist.bucketCounts[l]+=c.hist.bucketCounts[l]}else f.hist=c.hist}else this.Qt()&&this.Bt.set(o,c)}}};var Su,Hb,Kp;function p3(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return Kp&&i.length===Hb||(Hb=i.length,Kp=i.reduce(((r,o)=>{Su||(Su={});var c=Su[o];if(c)r[c[0]]=c[1];else for(var f=e(o),l=f.length-1;l>=0;l--){var d=f[l],m=d==null?void 0:d.filename,y=t[o];if(m&&y){r[m]=y,Su[o]=[m,y];break}}return r}),{})),Kp}}class m3{constructor(t,i,r){r===void 0&&(r=[]),this.coercers=t,this.stackParser=i,this.modifiers=r}buildFromUnknown(t,i){i===void 0&&(i={});var r=i&&i.mechanism||{handled:!0,type:"generic"},o=this.buildCoercingContext(r,i,0).apply(t),c=this.buildParsingContext(i),f=this.parseStacktrace(o,c);return{$exception_list:this.convertToExceptionList(f,r),$exception_level:"error"}}modifyFrames(t){var i=this;return rs((function*(){for(var r of t)r.stacktrace&&r.stacktrace.frames&&rt(r.stacktrace.frames)&&(r.stacktrace.frames=yield i.applyModifiers(r.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var r,o;return t.cause!=null&&(r=this.parseStacktrace(t.cause,i)),t.stack!=""&&t.stack!=null&&(o=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),Re({},t,{cause:r,stack:o})}applyChunkIds(t,i){return t.map((r=>(r.filename&&i&&(r.chunk_id=i[r.filename]),r)))}applyCoercers(t,i){for(var r of this.coercers)if(r.match(t))return r.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return rs((function*(){var r=t;for(var o of i.modifiers)r=yield o(r);return r}))()}convertToExceptionList(t,i){var r,o,c,f={type:t.type,value:t.value,mechanism:{type:(r=i.type)!==null&&r!==void 0?r:"generic",handled:(o=i.handled)===null||o===void 0||o,synthetic:(c=t.synthetic)!==null&&c!==void 0&&c}};t.stack&&(f.stacktrace={type:"raw",frames:t.stack});var l=[f];return t.cause!=null&&l.push(...this.convertToExceptionList(t.cause,Re({},i,{handled:!0}))),l}buildParsingContext(t){var i;return{chunkIdMap:p3(this.stackParser),skipFirstLines:(i=t.skipFirstLines)!==null&&i!==void 0?i:1}}buildCoercingContext(t,i,r){r===void 0&&(r=0);var o=(c,f)=>{if(4>=f){var l=this.buildCoercingContext(t,i,f);return this.applyCoercers(c,l)}};return Re({},i,{syntheticException:r==0?i.syntheticException:void 0,mechanism:t,apply:c=>o(c,r),next:c=>o(c,r+1)})}}var _o="?";function ev(e,t,i,r,o){var c={platform:e,filename:t,function:i==="<anonymous>"?_o:i,in_app:!0};return Me(r)||(c.lineno=r),Me(o)||(c.colno=o),c}var Hx=(e,t)=>{var i=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return i||r?[e.indexOf("@")!==-1?e.split("@")[0]:_o,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},v3=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,g3=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,_3=/\((\S*)(?::(\d+))(?::(\d+))\)/,y3=(e,t)=>{var i=v3.exec(e);if(i)return ev(t,i[1],_o,+i[2],+i[3]);var r=g3.exec(e);if(r){if(r[2]&&r[2].indexOf("eval")===0){var o=_3.exec(r[2]);o&&(r[2]=o[1],r[3]=o[2],r[4]=o[3])}var c=Hx(r[1]||_o,r[2]);return ev(t,c[1],c[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},b3=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,S3=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,w3=(e,t)=>{var i=b3.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=S3.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var o=i[3],c=i[1]||_o,f=Hx(c,o);return ev(t,o=f[1],c=f[0],i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},zb=/\(error: (.*)\)/;class x3{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var r=Kt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:r?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return Wd(t,"DOMException")}isDOMError(t){return Wd(t,"DOMError")}}class C3{match(t){return(i=>i instanceof Error)(t)}coerce(t,i){return{type:this.getType(t),value:this.getMessage(t,i),stack:this.getStack(t),cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,i){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 E3{constructor(){}match(t){return Wd(t,"ErrorEvent")&&t.error!=null}coerce(t,i){var r;return i.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:(r=i.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var k3=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class A3{match(t){return typeof t=="string"}coerce(t,i){var r,o=this.getInfos(t),c=o[0],f=o[1];return{type:c??"Error",value:f??t,stack:(r=i.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(t){var i="Error",r=t,o=t.match(k3);return o&&(i=o[1],r=o[2]),[i,r]}}var j3=["fatal","error","warning","log","info","debug"];function zx(e,t){t===void 0&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var o=i.slice(0,r).join(", ");if(t>=o.length)return r===i.length?o:o.length>t?o.slice(0,t)+"...":o}return""}class R3{match(t){return typeof t=="object"&&t!==null}coerce(t,i){var r,o=this.getErrorPropertyFromObject(t);return o?i.apply(o):{type:this.getType(t),value:this.getValue(t),stack:(r=i.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Zv(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var i="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(i+=" with message: '"+t.message+"'"),i}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: "+zx(t)}isSeverityLevel(t){return Kt(t)&&!Ym(t)&&j3.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var r=t[i];if(c3(r))return r}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch{return}}}class T3{match(t){return Zv(t)}coerce(t,i){var r,o=t.constructor.name;return{type:o,value:o+" captured as exception with keys: "+zx(t),stack:(r=i.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class N3{match(t){return mx(t)}coerce(t,i){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(r=i.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class M3{match(t){return Wd(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Zv(t))return!1;try{var i=t.detail;return i!=null&&typeof i=="object"&&"reason"in i}catch{return!1}}coerce(t,i){var r,o=this.getUnhandledRejectionReason(t);return mx(o)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(o),stack:(r=i.syntheticException)==null?void 0:r.stack,synthetic:!0}:i.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 Zd="$message",Qd="$timestamp",D3=new Set([Zd,Qd]),Yp={enabled:!0,max_bytes:32768};function eh(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Yp.enabled,max_bytes:$3(e.max_bytes,Yp.max_bytes)}:Re({},Yp)}class O3{constructor(t){this.$e=[],this.ze=0,this.Te=eh(t)}setConfig(t){this.Te=eh(t),this.Ze()}add(t){var i=(function(o){var c;try{c=hx(o)}catch{return}try{var f=JSON.parse(c);if(!ns(f))return;var l=f,d=l[Zd],m=l[Qd];return!Kt(d)||d.trim().length===0||!Kt(m)&&!Gs(m)?void 0:{step:l,json:c}}catch{return}})(t);if(i){var r=(function(o){if(typeof TextEncoder<"u")return new TextEncoder().encode(o).length;for(var c=encodeURIComponent(o),f=0,l=0;c.length>l;l++)c[l]==="%"?(f+=1,l+=2):f+=1;return f})(i.json);r>this.Te.max_bytes||(this.$e.push({step:i.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 $3(e,t){if(!Gs(e)||e===1/0||e===-1/0)return t;var i=Math.floor(e);return 0>i?t:i}var Ux=function(e,t){var i=(t===void 0?{}:t).debugEnabled,r={k(o){if(_e&&(Bt.DEBUG||_e.POSTHOG_DEBUG||i)&&!Me(_e.console)&&_e.console){for(var c=("__rrweb_original__"in _e.console[o])?_e.console[o].__rrweb_original__:_e.console[o],f=arguments.length,l=new Array(f>1?f-1:0),d=1;f>d;d++)l[d-1]=arguments[d];c(e,...l)}},debug(){for(var o=arguments.length,c=new Array(o),f=0;o>f;f++)c[f]=arguments[f];r.k("debug",...c)},info(){for(var o=arguments.length,c=new Array(o),f=0;o>f;f++)c[f]=arguments[f];r.k("log",...c)},warn(){for(var o=arguments.length,c=new Array(o),f=0;o>f;f++)c[f]=arguments[f];r.k("warn",...c)},error(){for(var o=arguments.length,c=new Array(o),f=0;o>f;f++)c[f]=arguments[f];r.k("error",...c)},critical(){for(var o=arguments.length,c=new Array(o),f=0;o>f;f++)c[f]=arguments[f];console.error(e,...c)},uninitializedWarning(o){r.error("You must initialize PostHog before calling "+o)},createLogger:(o,c)=>Ux(e+" "+o,c)};return r},De=Ux("[PostHog.js]"),os=De.createLogger,L3=os("[ExternalScriptsLoader]"),Xp=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return L3.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=Ie==null?void 0:Ie.querySelectorAll("script");if(r){for(var o,c=function(){if(r[f].src===t){var d=r[f];return d.__posthog_loading_callback_fired?{v:i()}:(d.addEventListener("load",(m=>{d.__posthog_loading_callback_fired=!0,i(void 0,m)})),d.onerror=m=>i(m),{v:void 0})}},f=0;r.length>f;f++)if(o=c())return o.v}var l=()=>{if(!Ie)return i("document not found");var d=Ie.createElement("script");if(d.type="text/javascript",d.crossOrigin="anonymous",d.src=t,d.onload=v=>{d.__posthog_loading_callback_fired=!0,i(void 0,v)},d.onerror=v=>i(v),e.config.prepare_external_dependency_script&&(d=e.config.prepare_external_dependency_script(d)),!d)return i("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")Ie.head.appendChild(d);else{var m,y=Ie.querySelectorAll("body > script");y.length>0?(m=y[0].parentNode)==null||m.insertBefore(d,y[0]):Ie.body.appendChild(d)}};Ie!=null&&Ie.body?l():Ie==null||Ie.addEventListener("DOMContentLoaded",l)};Ge.__PosthogExtensions__=Ge.__PosthogExtensions__||{},Ge.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{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)}Xp(e,r,i)}else{var f=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Xp(e,f,i)}},Ge.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var r=e.requestRouter.endpointFor("api",t);Xp(e,r,i)};Bt.DEBUG=!1,Bt.LIB_VERSION="1.409.5",Bt.LIB_NAME="web";var qx="$people_distinct_id",Ql="$device_id",Jp="$device_model",Pl="__alias",Bl="__timers",tv="$autocapture_disabled_server_side",sv="$heatmaps_enabled_server_side",iv="$exception_capture_enabled_server_side",nv="$error_tracking_suppression_rules",rv="$error_tracking_capture_extension_exceptions",av="$web_vitals_enabled_server_side",ig="$dead_clicks_enabled_server_side",ng="$product_tours_enabled_server_side",ov="$web_vitals_allowed_metrics",aa="$session_recording_remote_config",Fx="$replay_sample_rate",Vx="$replay_override_sampling",Wx="$replay_override_linked_flag",Gx="$replay_override_url_trigger",Kx="$replay_override_event_trigger",ao="$sesid",rg="$session_is_sampled",na="$enabled_feature_flags",$d="$active_feature_flags",Hl="$early_access_features",lv="$feature_flag_details",Ld="$feature_flag_payloads",cv="$feature_flag_request_id",th="$minimal_flag_called_events",Hn="$override_feature_flags",io="$override_feature_flag_payloads",ea="$stored_person_properties",ta="$stored_group_properties",uv="$surveys",sh="$surveys_loaded_at",dv="$surveys_activated",Id="$surveys_activated_session",zl="ph_product_tours",Wl="$flag_call_reported",hv="$flag_call_reported_session_id",fv="$feature_flag_errors",ec="$feature_flag_evaluated_at",Fi="$user_state",pv="$client_session_props",mv="$capture_rate_limit",vv="$initial_campaign_params",gv="$initial_referrer_info",ih="$initial_person_info",nh="$epp",wu="$posthog_cookieless",Yx="$cookieless_mode",Xx="$sdk_debug_extensions_init_method",Jx="$sdk_debug_extensions_init_time_ms",Zx="$sdk_debug_recording_script_not_loaded",ag="PostHog loadExternalDependency extension not found.",sa="on_reject",qn="always",Ka="anonymous",qr="identified",_v="identified_only",rh="visibilitychange",ah="beforeunload",no="$pageview",Zp="$pageleave",Qp="$identify",Ub="$groupidentify";function xu(e,t){rt(e)&&e.forEach(t)}function Yt(e,t){if(!lt(e))if(rt(e))e.forEach(t);else if(GT(e))e.forEach(((r,o)=>t(r,o)));else for(var i in e)px.call(e,i)&&t(e[i],i)}var Zt=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;t>r;r++)i[r-1]=arguments[r];for(var o of i)for(var c in o)o[c]!==void 0&&(e[c]=o[c]);return e};function Pd(e){for(var t=Object.keys(e),i=t.length,r=new Array(i);i--;)r[i]=[t[i],e[t[i]]];return r}var qb=function(e){try{return e()}catch{return}},I3=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];return e.apply(this,i)}catch(o){De.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),De.critical(o)}}},og=function(e){var t={};return Yt(e,(function(i,r){(Kt(i)&&i.length>0||Gs(i))&&(t[r]=i)})),t},P3=["herokuapp.com","vercel.app","netlify.app"];function B3(e){var t=e==null?void 0:e.hostname;if(!Kt(t))return!1;var i=t.split(".").slice(-2).join(".");for(var r of P3)if(i===r)return!1;return!0}function us(e,t,i,r){var o=r??{},c=o.capture,f=o.passive;e==null||e.addEventListener(t,i,{capture:c!==void 0&&c,passive:f===void 0||f})}function Qx(e){return e.name==="ph_toolbar_internal"}var eC=e=>{if(Ie){try{for(var t=e+"=",i=Ie.cookie.split(";").filter((c=>c.length)),r=0;i.length>r;r++){for(var o=i[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 Gs(e)&&isFinite(e)&&Math.floor(e)===e});class oh{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,r,o){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||!Number.isInteger(o)||0>t||0>i||0>r||0>o||t>0xffffffffffff||i>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|i>>>8,c[7]=i,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 oh(c)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),i!==3&&i!==5&&i!==7&&i!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new oh(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var i=0;16>i;i++){var r=this.bytes[i]-t.bytes[i];if(r!==0)return Math.sign(r)}return 0}}class H3{generate(){var t=this.generateOrAbort();if(!Me(t))return t;this.S=0;var i=this.generateOrAbort();if(Me(i))throw new Error("Could not generate UUID after timestamp reset");return i}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 oh.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 z3}}var Fb,tC=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&&!Me(_e.crypto)&&crypto.getRandomValues&&(tC=e=>crypto.getRandomValues(e));class z3{nextUint32(){return this.R.length>this.O||(tC(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var Un=()=>U3().toString(),U3=()=>(Fb||(Fb=new H3)).generate(),xl="",q3=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Fn={N:()=>!!Ie,P(e){De.error("cookieStore error: "+e)},q:eC,F(e){var t;try{t=JSON.parse(Fn.q(e))||{}}catch{}return t},A(e,t,i,r,o){if(!Ie)return!1;try{var c="",f="",l=(function(y,v){if(v){var S=(function(R,x){if(x===void 0&&(x=Ie),xl)return xl;if(!x||["localhost","127.0.0.1"].includes(R))return"";for(var g=R.split("."),b=Math.min(g.length,8),p="dmn_chk_"+Un();!xl&&b--;){var _=g.slice(b).join("."),k=p+"=1;domain=."+_+";path=/";x.cookie=k+";max-age=3",x.cookie.includes(p)&&(x.cookie=k+";max-age=0",xl=_)}return xl})(y);if(!S){var w=(R=>{var x=R.match(q3);return x?x[0]:""})(y);w!==S&&De.info("Warning: cookie subdomain discovery mismatch",w,S),S=w}return S?"; domain=."+S:""}return""})(Ie.location.hostname,r);if(i){var d=new Date;d.setTime(d.getTime()+864e5*i),c="; expires="+d.toUTCString()}o&&(f="; secure");var m=e+"="+encodeURIComponent(JSON.stringify(t))+c+"; SameSite=Lax; path=/"+l+f;return m.length>3686.4&&De.warn("cookieStore warning: large cookie, len="+m.length),Ie.cookie=m,!0}catch{return!1}},D(e,t){if(Ie!=null&&Ie.cookie)try{Fn.A(e,"",-1,t)}catch{return}}},em=null,Jt={N(){if(!oi(em))return em;var e=!0;if(Me(_e))e=!1;else try{var t="__mplssupport__";Jt.A(t,"xyz"),Jt.q(t)!=='"xyz"'&&(e=!1),Jt.D(t)}catch{e=!1}return e||De.error("localStorage unsupported; falling back to cookie store"),em=e,e},P(e){De.error("localStorage error: "+e)},q(e){try{return _e==null?void 0:_e.localStorage.getItem(e)}catch(t){Jt.P(t)}return null},F(e){try{return JSON.parse(Jt.q(e))||{}}catch{}return null},A(e,t){try{return _e==null||_e.localStorage.setItem(e,JSON.stringify(t)),!0}catch(i){Jt.P(i)}return!1},D(e){try{_e==null||_e.localStorage.removeItem(e)}catch(t){Jt.P(t)}}},F3=[Ql,"distinct_id",ao,rg,nh,ih,Fi],Cu={},V3={N:()=>!0,P(e){De.error("memoryStorage error: "+e)},q:e=>Cu[e]||null,F:e=>Cu[e]||null,A:(e,t)=>(Cu[e]=t,!0),D(e){delete Cu[e]}},Fr=null,Ws={N(){if(!oi(Fr))return Fr;if(Fr=!0,Me(_e))Fr=!1;else try{var e="__support__";Ws.A(e,"xyz"),Ws.q(e)!=='"xyz"'&&(Fr=!1),Ws.D(e)}catch{Fr=!1}return Fr},P(e){De.error("sessionStorage error: ",e)},q(e){try{return _e==null?void 0:_e.sessionStorage.getItem(e)}catch(t){Ws.P(t)}return null},F(e){try{return JSON.parse(Ws.q(e))||null}catch{}return null},A(e,t){try{return _e==null||_e.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(i){Ws.P(i)}return!1},D(e){try{_e==null||_e.sessionStorage.removeItem(e)}catch(t){Ws.P(t)}}};class W3{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===qn||this.isRejected()||this.consent===-1&&this.Te.cookieless_mode===sa}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,i=t.token,r=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(r?r+i:"__ph_opt_in_out_"+i)}get Qe(){var t=this.Je.q(this.Ke);return Vp(t)?1:st(JT,t)?0:-1}get Je(){var t=this.Te.opt_out_capturing_persistence_type,i=t==="localStorage"?Jt:Fn;if(!this.Ye||this.Ye!==i){this.Ye=i;var r=t==="localStorage"?Fn:Jt;r.q(this.Ke)&&(this.Ye.q(this.Ke)||this.optInOut(Vp(r.q(this.Ke))),r.D(this.Ke,this.Te.cross_subdomain_cookie))}return this.Ye}Ge(){return!!this.Te.respect_dnt&&[ai==null?void 0:ai.doNotTrack,ai==null?void 0:ai.msDoNotTrack,Ge.doNotTrack].some((t=>Vp(t)))}}function sC(e,t){var i,r=e==null||(i=e.config)==null?void 0:i.get_current_url;if(!Ri(r))return t;try{var o=r(t);return Kt(o)&&o?o:t}catch(c){return De.error("Error in get_current_url, falling back to window.location.href",c),t}}var iC="__POSTHOG_TOOLBAR__",G3=1,K3=3,Y3=11;function Vb(e){return e instanceof Element&&(e.id===iC||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Cr(e){return!!e&&e.nodeType===G3}function Ti(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function nC(e){return!!e&&e.nodeType===K3}function rC(e){return!!e&&e.nodeType===Y3&&Cr(e.host)}var aC=1e3;function lg(e){return e?Ch(e).split(/\s+/):[]}function Wb(e,t){var i=(function(r){var o,c=_e==null||(o=_e.location)==null?void 0:o.href;return Me(c)?void 0:sC(r,c)})(t);return!!(i&&e&&e.some((r=>i.match(r))))}function lh(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 lg(t)}function oC(e){return lt(e)?null:Ch(e).split(/(\s+)/).filter((t=>Gl(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function tc(e){var t="";return bv(e)&&!dC(e)&&e.childNodes&&e.childNodes.length&&Yt(e.childNodes,(function(i){var r;nC(i)&&i.textContent&&(t+=(r=oC(i.textContent))!==null&&r!==void 0?r:"")})),Ch(t)}function tm(e){var t;return Me(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var cg=["a","button","form","input","select","textarea","label"];function yv(e,t){if(Me(t))return!0;var i,r=function(c){if(t.some((f=>(function(l,d){var m=l.matches||l.matchesSelector||l.msMatchesSelector||l.mozMatchesSelector||l.webkitMatchesSelector||l.oMatchesSelector;try{return!!m&&m.call(l,d)}catch{return!1}})(c,f))))return{v:!0}};for(var o of e)if(i=r(o))return i.v;return!1}function lC(e){var t=e.parentNode;return!(!t||!Cr(t))&&t}var X3=[".ph-no-autocapture","[data-ph-no-autocapture]"],cC=["next","previous","prev",">","<"],J3=[...cC,"+","-","−","–"],Gb=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Kb=[".ph-no-rageclick",".ph-no-capture"],Z3=["","text","search","email","password","url","tel","number"];function Yb(e,t){if(!_e||ug(e))return!1;var i,r,o,c,f;if(Qi(t)?(i=!!t&&Kb,r=void 0,o=!1):(i=(c=t==null?void 0:t.css_selector_ignorelist)!==null&&c!==void 0?c:Kb,r=t==null?void 0:t.content_ignorelist,o=(f=t==null?void 0:t.ignore_text_selection)!==null&&f!==void 0&&f),i===!1||o&&(function(d){return!(!d||!Cr(d))&&(!!Ti(d,"textarea")||(Ti(d,"input")?st(Z3,(d.getAttribute("type")||"").toLowerCase()):(function(m){if(m.isContentEditable)return!0;var y=m.getAttribute==null?void 0:m.getAttribute("contenteditable");return y==="true"||y===""})(d)))})(e))return!1;var l=uC(e,!1).targetElementList;return!(function(d,m){if(d===!1||Me(d))return!1;var y;if(d===!0)y=cC;else{if(!rt(d))return!1;if(d.length>10)return De.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;y=d.map((v=>v.toLowerCase()))}return m.some((v=>{var S=v.safeText,w=v.ariaLabel;return y.some((R=>Gb(S,R)||Gb(w,R)))}))})(r,l.map((d=>{var m;return{safeText:tc(d).toLowerCase(),ariaLabel:((m=d.getAttribute("aria-label"))==null?void 0:m.toLowerCase().trim())||""}})))&&!yv(l,i)}var ug=e=>!e||Ti(e,"html")||!Cr(e),uC=(e,t)=>{if(!_e||ug(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[e],o=e;o.parentNode&&!Ti(o,"body");)if(rC(o.parentNode))r.push(o.parentNode.host),o=o.parentNode.host;else{var c=lC(o);if(!c)break;if(t||cg.indexOf(c.tagName.toLowerCase())>-1)i=!0;else try{var f=_e.getComputedStyle(c);f&&f.getPropertyValue("cursor")==="pointer"&&(i=!0)}catch{}r.push(c),o=c}return{parentIsUsefulElement:i,targetElementList:r}};function bv(e){for(var t=new Set,i=0,r=e;r.parentNode&&!Ti(r,"body");r=r.parentNode){if(i++>=aC||t.has(r))return!1;t.add(r);var o=lh(r);if(st(o,"ph-sensitive")||st(o,"ph-no-capture"))return!1}if(st(lh(e),"ph-include"))return!0;var c=e.type||"";if(Kt(c))switch(c.toLowerCase()){case"hidden":case"password":return!1}var f=e.name||e.id||"";return!Kt(f)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(f.replace(/[^a-zA-Z0-9]/g,""))}function dC(e){return!!(Ti(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Ti(e,"select")||Ti(e,"textarea")||e.getAttribute("contenteditable")==="true")}var Xb=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}))$"),Jb=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Q3=[16,15,14,13],eN=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Zb=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Qb=/[0-9A-Za-z_]/;function tN(e){for(var t=0,i=!1,r=e.length-1;r>=0;r--){var o=e.charCodeAt(r)-48;i&&(o*=2)>9&&(o-=9),t+=o,i=!i}return t%10==0}function Gl(e,t){if(t===void 0&&(t=!0),lt(e))return!1;if(Kt(e)){e=Ch(e);var i=t?Xb.test((e||"").replace(/[- ]/g,"")):(function(o){var c;for(Jb.lastIndex=0;c=Jb.exec(o);){var f=c[2];if(f)for(var l=f.replace(/[- ]/g,""),d=0;l.length>d;d++)for(var m of Q3){var y=d+m;if(l.length>=y){var v=l.slice(d,y);if(Xb.test(v)&&tN(v))return!0}}}return!1})(e);if(i)return!1;var r=t?eN.test(e):(function(o){var c;for(Zb.lastIndex=0;c=Zb.exec(o);){var f=c[1],l=c[3];if(!(f&&l&&Qb.test(f)&&Qb.test(l)))return!0}return!1})(e);if(r)return!1}return!0}function e1(e){var t=tc(e);return Gl(t=(t+" "+hC(e)).trim())?t:""}function hC(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Yt(e.childNodes,(function(i){var r;if(i&&((r=i.tagName)==null?void 0:r.toLowerCase())==="span")try{var o=tc(i);t=(t+" "+o).trim(),i.childNodes&&i.childNodes.length&&(t=(t+" "+hC(i)).trim())}catch(c){De.error("[AutoCapture]",c)}})),t}function t1(e){return e.replace(/"|\\"/g,'\\"')}function sN(e){var t=e.attr__class;if(t)return rt(t)?t:lg(t)}var Eu=os("[Dead Clicks]"),iN=()=>!0,nN=e=>{var t,i=!((t=e.instance.persistence)==null||!t.get_property(ig)),r=e.instance.config.capture_dead_clicks;return Qi(r)?r:!!ns(r)||i};class s1{get lazyLoadedDeadClicksAutocapture(){return this.Xe}constructor(t,i,r){this.instance=t,this.isEnabled=i,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[ig]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.tr((()=>{this.er()})):this.stop()}tr(t){var i,r;(i=Ge.__PosthogExtensions__)!=null&&i.initDeadClicksAutocapture?t():(r=Ge.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(o=>{o?Eu.error("failed to load script",o):t()}))}er(){var t;if(Ie){if(!this.Xe&&(t=Ge.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var i=ns(this.instance.config.capture_dead_clicks)?Re({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.Xe=Ge.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.Xe.start(Ie),Eu.info("starting...")}}else Eu.error("`document` not found. Cannot start.")}stop(){this.Xe&&(this.Xe.stop(),this.Xe=void 0,Eu.info("stopping..."))}}var sm=os("[SegmentIntegration]"),fC="posthog-js";function pC(e,t){var i=t===void 0?{}:t,r=i.organization,o=i.projectId,c=i.prefix,f=i.severityAllowList,l=f===void 0?["error"]:f,d=i.sendExceptionsToPostHog,m=d===void 0||d;return y=>{var v,S,w,R,x;if(l!=="*"&&!l.includes(y.level)||!e.__loaded)return y;y.tags||(y.tags={});var g=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());y.tags["PostHog Person URL"]=g,e.sessionRecordingStarted()&&(y.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var b,p=((v=y.exception)==null?void 0:v.values)||[],_=p.map((A=>Re({},A,{stacktrace:A.stacktrace?Re({},A.stacktrace,{type:"raw",frames:(A.stacktrace.frames||[]).map((C=>Re({},C,{platform:"web:javascript"})))}):void 0}))),k={$exception_message:((S=p[0])==null?void 0:S.value)||y.message,$exception_type:(w=p[0])==null?void 0:w.type,$exception_level:y.level,$exception_list:_,$sentry_event_id:y.event_id,$sentry_exception:y.exception,$sentry_exception_message:((R=p[0])==null?void 0:R.value)||y.message,$sentry_exception_type:(x=p[0])==null?void 0:x.type,$sentry_tags:y.tags};return r&&o&&(k.$sentry_url=(c||"https://sentry.io/organizations/")+r+"/issues/?project="+o+"&query="+y.event_id),m&&((b=e.exceptions)==null||b.sendExceptionEvent(k)),y}}class rN{constructor(t,i,r,o,c,f){this.name=fC,this.setupOnce=function(l){l(pC(t,{organization:i,projectId:r,prefix:o,severityAllowList:c,sendExceptionsToPostHog:f==null||f}))}}}class i1{constructor(t){this.rr=(i,r,o)=>{o&&(o.noSessionId||o.activityTimeout||o.sessionPastMaximumLength||o.crossTabAdoption)&&(De.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:i,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,i){var r,o=this.ar(t,i);return this.ir={pathname:(r=_e==null?void 0:_e.location.pathname)!==null&&r!==void 0?r:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),o}doPageLeave(t){var i;return this.ar(t,(i=this.ir)==null?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.ir)==null?void 0:t.pageViewId}}ar(t,i){var r=this.ir;if(!r)return{$pageview_id:i};var o={$pageview_id:i,$prev_pageview_id:r.pageViewId},c=this._instance.scrollManager.getContext();if(c&&!this._instance.config.disable_scroll_properties){var f=c.maxScrollHeight,l=c.lastScrollY,d=c.maxScrollY,m=c.maxContentHeight,y=c.lastContentY,v=c.maxContentY;if(!(Me(f)||Me(l)||Me(d)||Me(m)||Me(y)||Me(v))){f=Math.ceil(f),l=Math.ceil(l),d=Math.ceil(d),m=Math.ceil(m),y=Math.ceil(y),v=Math.ceil(v);var S=f>1?hn(l/f,0,1,De):1,w=f>1?hn(d/f,0,1,De):1,R=m>1?hn(y/m,0,1,De):1,x=m>1?hn(v/m,0,1,De):1;o=Zt(o,{$prev_pageview_last_scroll:l,$prev_pageview_last_scroll_percentage:S,$prev_pageview_max_scroll:d,$prev_pageview_max_scroll_percentage:w,$prev_pageview_last_content:y,$prev_pageview_last_content_percentage:R,$prev_pageview_max_content:v,$prev_pageview_max_content_percentage:x})}}return r.pathname&&(o.$prev_pageview_pathname=r.pathname),r.timestamp&&(o.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),o}}var im=["flags","surveys"],aN={[qx]:{exposure:"hidden"},[Pl]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Bl]:{exposure:"hidden"},[tv]:{exposure:"event"},[sv]:{exposure:"hidden"},[iv]:{exposure:"event"},[nv]:{exposure:"hidden"},[rv]:{exposure:"event"},[av]:{exposure:"event"},[ig]:{exposure:"event"},[ng]:{exposure:"hidden"},[ov]:{exposure:"event"},[aa]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[ao]:{exposure:"hidden"},[rg]:{exposure:"event"},[Fx]:{exposure:"event",shouldSkipFromEventProperties:e=>oi(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"},[na]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!ns(e))return{};for(var t={},i=Object.keys(e),r=0;i.length>r;r++)t["$feature/"+i[r]]=e[i[r]];return t}},[$d]:{exposure:"event",storageGroup:"flags"},[Hl]:{exposure:"hidden"},[lv]:{exposure:"hidden",storageGroup:"flags"},[Ld]:{exposure:"event",storageGroup:"flags"},[cv]:{exposure:"event",storageGroup:"flags",volatile:!0},[th]:{exposure:"hidden",storageGroup:"flags"},[Hn]:{exposure:"event"},[io]:{exposure:"hidden"},[ea]:{exposure:"hidden"},[ta]:{exposure:"hidden"},[uv]:{exposure:"hidden",storageGroup:"surveys"},[sh]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[dv]:{exposure:"event"},[Id]:{exposure:"hidden"},[zl]:{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"},[Wl]:{exposure:"hidden"},[hv]:{exposure:"hidden"},[fv]:{exposure:"hidden"},[ec]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Fi]:{exposure:"hidden"},[pv]:{exposure:"hidden"},[mv]:{exposure:"hidden"},[vv]:{exposure:"hidden"},[gv]:{exposure:"hidden"},[ih]:{exposure:"hidden"},[nh]:{exposure:"hidden"},[Vx]:{exposure:"event"},[Wx]:{exposure:"event"},[Gx]:{exposure:"event"},[Kx]:{exposure:"event"},[Xx]:{exposure:"event"},[Jx]:{exposure:"event"},[Zx]:{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"}},oN=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Vr=e=>{var t=aN[e];if(t)return t;for(var i of oN){var r=i[1];if(e.indexOf(i[0])===0)return r}},oo=(e,t)=>{try{return JSON.stringify(e,((i,r)=>typeof r=="bigint"?r.toString():r),t)}catch{return hx(e)}},ch=e=>{var t=Ie==null?void 0:Ie.createElement("a");return Me(t)?null:(t.href=e,t)},yo=function(e,t){for(var i,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),o=0;r.length>o;o++){var c=r[o].split("=");if(c[0]===t){i=c;break}}if(!rt(i)||2>i.length)return"";var f=i[1];try{f=decodeURIComponent(f)}catch{De.error("Skipping decoding for malformed query param: "+f)}return f.replace(/\+/g," ")},sc=function(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),o=r[1],c=(r[0]||"").split("?"),f=c[1],l=c[0],d=(f||"").split("&"),m=[],y=0;d.length>y;y++){var v=d[y].split("=");rt(v)&&(t.includes(v[0])?m.push(v[0]+"="+i):m.push(d[y]))}var S=l;return f!=null&&(S+="?"+m.join("&")),o!=null&&(S+="#"+o),S},uh=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},mC=(e,t)=>e>=t&&cx(),vC=(e,t,i,r)=>{if(e===0){if(cx()){var o=t+1;return o===i&&r(),o}return t}return 0},ku="https?://(.*)",bo=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],lN=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...bo],ic="<masked>",cN=["li_fat_id"];function gC(e,t,i){if(!Ie)return{};var r,o=t?[...bo,...i||[]]:[],c=_C(sc(Ie.URL,o,ic),e),f=(r={},Yt(cN,(function(l){var d=eC(l);r[l]=d||null})),r);return Zt(f,c)}function _C(e,t){var i=lN.concat(t||[]),r={};return Yt(i,(function(o){var c=yo(e,o);r[o]=c||null})),r}function yC(e){var t=(function(c){return c?c.search(ku+"google.([^/?]*)")===0?"google":c.search(ku+"bing.com")===0?"bing":c.search(ku+"yahoo.com")===0?"yahoo":c.search(ku+"duckduckgo.com")===0?"duckduckgo":null:null})(e),i=t!="yahoo"?"q":"p",r={};if(!oi(t)){r.$search_engine=t;var o=Ie?yo(Ie.referrer,i):"";o.length&&(r.ph_keyword=o)}return r}function n1(){return navigator.language||navigator.userLanguage}var dh="$direct";function bC(){return(Ie==null?void 0:Ie.referrer)||dh}function SC(e,t,i){i===void 0&&(i=!1);var r=e?[...bo,...t||[]]:[],o=i?xr(ws==null?void 0:ws.href):ws==null?void 0:ws.href,c=o==null?void 0:o.substring(0,1e3);return{r:bC().substring(0,1e3),u:c?sc(c,r,ic):void 0}}function wC(e,t){var i;t===void 0&&(t=!1);var r=e.r,o=e.u,c=t?xr(o):o,f={$referrer:r,$referring_domain:r==null?void 0:r==dh?dh:(i=ch(r))==null?void 0:i.host};if(c){f.$current_url=c;var l=ch(c);f.$host=l==null?void 0:l.host,f.$pathname=l==null?void 0:l.pathname;var d=_C(c);Zt(f,d)}if(r){var m=yC(r);Zt(f,m)}return f}function xC(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function uN(){try{return new Date().getTimezoneOffset()}catch{return}}var dN={flags:ec,surveys:sh},hN=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ya="main";class nm{constructor(t,i,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 f="";return c.token&&(f=c.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),c.persistence_name?"ph_"+c.persistence_name:"ph_"+f+"_posthog"})(t),this.Je=this.pr(t),this.hr=this.gr(t),this.load(),t.debug&&De.info("Persistence loaded",t.persistence,Re({},this.props)),this.update_config(t,t,i),this.save(),_e){var o=()=>this.flush();us(_e,"beforeunload",o,{capture:!1}),us(_e,"pagehide",o,{capture:!1})}}mr(){var t,i=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return Gs(i)&&i>0?i:0}isDisabled(){return!!this.yr}pr(t){hN.indexOf(t.persistence.toLowerCase())===-1&&(De.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i,r=(function(f,l){f===void 0&&(f=[]),l===void 0&&(l=!1);var d=[...F3,...f];return Re({},Jt,{F(m){try{var y={};try{y=Fn.F(m)||{}}catch{}var v,S=JSON.parse(Jt.q(m)||"{}");if(l){var w={};for(var R in y){var x=y[R];oi(x)||x===""||(w[R]=x)}v=Zt(S,w)}else v=Zt(y,S);return Jt.A(m,v),v}catch{}return null},A(m,y,v,S,w,R){var x=Jt.A(m,y,void 0,void 0,R);try{var g={};d.forEach((b=>{y[b]&&(g[b]=y[b])})),Object.keys(g).length&&Fn.A(m,g,v,S,w,R)}catch(b){Jt.P(b)}return x},D(m,y){try{_e==null||_e.localStorage.removeItem(m),Fn.D(m,y)}catch(v){Jt.P(v)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),o=!1,c=t.persistence.toLowerCase();return c==="localstorage"&&Jt.N()?(i=Jt,o=!0):c==="localstorage+cookie"&&r.N()?(i=r,o=!0):c==="sessionstorage"&&Ws.N()?i=Ws:c==="memory"?i=V3:c==="cookie"?i=Fn:r.N()?(i=r,o=!0):i=Fn,this.ur=o,i}br(t){return this.vr+"__"+t}gr(t){return this.ur&&!!t.split_storage}_r(t){var i=t??this.Te.feature_flag_cache_ttl_ms;if(!i||0>=i)return!1;var r=this.props[ec];return!r||typeof r!="number"||Date.now()-r>i}properties(){var t={};return Yt(this.props,((i,r)=>{var o=Vr(r);if((o==null?void 0:o.exposure)==="derived"){if(o.shouldSkipFromEventProperties!=null&&o.shouldSkipFromEventProperties(i,r===na?()=>this._r():()=>!1))return;o.transformToEventProperties&&Zt(t,o.transformToEventProperties(i))}else if(!o||o.exposure==="event"){if(o!=null&&o.shouldSkipFromEventProperties!=null&&o.shouldSkipFromEventProperties(i,(()=>!1)))return;t[r]=i}})),t}load(){if(!this.yr){var t=this.Je.F(this.vr);t&&(this.props=Zt({},t)),this.hr&&this.wr()}}wr(){for(var t of im){var i=Jt.F(this.br(t));if(i&&!Sr(i)){var r=this.kr(t);r.persisted=!0,this.Sr(t)||(r.fingerprint=this.Cr(i,t)),this.Mr(t,i)||Zt(this.props,i)}}}Sr(t){return Object.keys(this.props).some((i=>{var r;return((r=Vr(i))==null?void 0:r.storageGroup)===t}))}Mr(t,i){var r=dN[t];if(!r)return!1;var o=i[r],c=this.props[r];return Gs(o)&&Gs(c)&&c>o}refreshKey(t){var i;if(!this.yr){var r=this.hr?(i=Vr(t))==null?void 0:i.storageGroup:void 0,o=r?Jt.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?Me(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),t)):this.Rr()}}flush(){Me(this.Er)||(clearTimeout(this.Er),this.Er=void 0,this.Rr())}Rr(){this.yr||(this.hr?this.Pr():this.Or(this.Je,this.vr,this.props,Ya))}Pr(){var t=this.Fr(),i=t.main,r=t.groups;for(var o of(this.Or(this.Je,this.vr,i,Ya),im)){var c,f=r[o];(!Sr(f)||(c=this.lr[o])!=null&&c.persisted)&&this.Or(Jt,this.br(o),f,o)}}Fr(){var t={},i={flags:{},surveys:{}};return Yt(this.props,((r,o)=>{var c,f=(c=Vr(o))==null?void 0:c.storageGroup;f?i[f][o]=r:t[o]=r})),{main:t,groups:i}}Cr(t,i){if(i===Ya)return JSON.stringify(t)+"|"+this.Ar+"|"+this.$r+"|"+this.Lr;var r={};return Yt(t,((o,c)=>{var f;r[c]=(f=Vr(c))!=null&&f.volatile?"__volatile__":o})),JSON.stringify(r)}Or(t,i,r,o){var c=this.kr(o);if(o===Ya||c.dirty||Me(c.fingerprint)){var f;try{if((f=this.Cr(r,o))===c.fingerprint)return void(c.dirty=!1)}catch{f=void 0}t.A(i,r,this.Ar,this.$r,this.Lr,this.Te.debug)?(c.dirty=!1,o!==Ya&&(c.persisted=!0),Me(f)||(c.fingerprint=f)):this.Te.debug&&De.warn('failed to persist storage entry "'+i+'"; will retry on next save')}}remove(t){var i=(t===void 0?{}:t).keepGroupEntries,r=i!==void 0&&i;if(Me(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 im)Jt.D(this.br(o));r?delete this.lr[Ya]:this.lr={}}clear(){this.remove(),this.props={}}register_once(t,i,r){if(ns(t)){Me(i)&&(i="None"),this.Ar=Me(r)?this.Dr:r;var o=!1;if(Yt(t,((c,f)=>{this.props.hasOwnProperty(f)&&this.props[f]!==i||(this.Ir(f,c),o=!0)})),o)return this.save(),!0}return!1}register(t,i){if(ns(t)){this.Ar=Me(i)?this.Dr:i;var r=!1;if(Yt(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=Ie==null?void 0:Ie.URL;if(t!==this.cr){var i=gC(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);Sr(og(i))||this.register(i),this.cr=t}}update_search_keyword(){var t;this.register((t=Ie==null?void 0:Ie.referrer)?yC(t):{})}update_referrer_info(){var t;this.register_once({$referrer:bC(),$referring_domain:Ie!=null&&Ie.referrer&&((t=ch(Ie.referrer))==null?void 0:t.host)||dh},void 0)}set_initial_person_info(){this.props[vv]||this.props[gv]||this.register_once({[ih]:SC(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={};Yt([gv,vv],(o=>{var c=this.props[o];c&&Yt(c,(function(f,l){t["$initial_"+Km(l)]=f}))}));var i=this.props[ih];if(i){var r=(function(o,c){c===void 0&&(c=!1);var f=wC(o,c),l={};return Yt(f,(function(d,m){l["$initial_"+Km(m)]=d})),l})(i,this.Te.disable_capture_url_hashes);Zt(t,r)}return t}safe_merge(t){return Yt(this.props,(function(i,r){r in t||(t[r]=i)})),t}update_config(t,i,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!==i.persistence||!((d,m)=>{if(d.length!==m.length)return!1;var y=[...d].sort(),v=[...m].sort();return y.every(((S,w)=>S===v[w]))})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),c=o?this.pr(t):this.Je,f=this.gr(t);if(o||f!==this.hr){var l=this.props;this.clear(),this.Je=c,this.hr=f,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,i){var r=this.props[Bl]||{};r[t]=i,this.Ir(Bl,r),this.save()}remove_event_timer(t){var i=this.props[Bl]||{},r=i[t];return Me(r)||(delete i[t],this.Ir(Bl,i),this.save()),r}get_property(t){return this.props[t]}set_property(t,i){this.Ir(t,i),this.save()}Ir(t,i){var r;this.props[t]=i,(r=Vr(t))!=null&&r.volatile||this.Nr(t)}Tr(t){delete this.props[t],this.Nr(t)}Nr(t){var i,r=(i=Vr(t))==null?void 0:i.storageGroup;r&&(this.kr(r).dirty=!0)}kr(t){return this.lr[t]||(this.lr[t]={})}}function Au(e){var t=!0;return{dispose(){if(t){t=!1;var i=e();i&&Ri(i.then)&&i.then(void 0,(()=>{}))}}}}var ri={GZipJS:"gzip-js",Base64:"base64"},Cl={Activation:"events",Cancellation:"cancelEvents"},rm={Popover:"popover",API:"api",Widget:"widget"},Vn={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},am={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Sv={Popover:"popover",Inline:"inline"},fN={SHOWN:"product tour shown"},r1={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},a1=os("[RateLimiter]");class pN{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=i=>{var r=i.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((o=>{a1.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4}))}catch(o){return void a1.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 i,r,o;t===void 0&&(t=!1);var c=this.captureEventsBurstLimit,f=this.captureEventsPerSecond,l=new Date().getTime(),d=(i=(r=this.instance.persistence)==null?void 0:r.get_property(mv))!==null&&i!==void 0?i:{tokens:c,last:l};d.tokens+=(l-d.last)/1e3*f,d.last=l,d.tokens>c&&(d.tokens=c);var m=1>d.tokens;return m||t||(d.tokens=Math.max(0,d.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 "+f+" events per second and "+c+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=m,(o=this.instance.persistence)==null||o.set_property(mv,d),{isRateLimited:m,remainingTokens:d.tokens}}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return i!==!1&&new Date().getTime()<i}}var Wr=os("[RemoteConfig]");class CC{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Ge._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}qr(t){var i,r;(i=Ge.__PosthogExtensions__)!=null&&i.loadExternalDependency?(r=Ge.__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(i){t(i.json)}})}load(){try{if(this.remoteConfig)return Wr.info("Using preloaded remote config",this.remoteConfig),this.Br(this.remoteConfig),void this.Hr();if(this._instance.Ur())return void Wr.warn("Remote config is disabled. Falling back to local config.");this.qr((t=>{if(!t)return Wr.info("No config found after loading remote JS config. Falling back to JSON."),void this.jr((i=>{this.Br(i),this.Hr()}));this.Br(t),this.Hr()}))}catch(t){Wr.error("Error loading remote config",t),this.Br()}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&Ie&&Ie.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Hr(){var t;if(!this.zr){var i=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;i!==0&&(this.zr=setInterval((()=>{this.refresh()}),i))}}Br(t){t||Wr.error("Failed to fetch remote config from PostHog.");try{this._instance.Br(t?{ok:!0,config:t}:{ok:!1})}catch(r){Wr.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 i;(i=this._instance.featureFlags)==null||i.ensureFlagsLoaded()}catch(r){Wr.error("Error loading feature flags",r)}}}var Wi=Uint8Array,vi=Uint16Array,So=Uint32Array,dg=new Wi([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]),hg=new Wi([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]),o1=new Wi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),EC=function(e,t){for(var i=new vi(31),r=0;31>r;++r)i[r]=t+=1<<e[r-1];var o=new So(i[30]);for(r=1;30>r;++r)for(var c=i[r];i[r+1]>c;++c)o[c]=c-i[r]<<5|r;return[i,o]},kC=EC(dg,2),wv=kC[1];kC[0][28]=258,wv[258]=28;for(var l1=EC(hg,0)[1],AC=new vi(32768),as=0;32768>as;++as){var Xa=(43690&as)>>>1|(21845&as)<<1;AC[as]=((65280&(Xa=(61680&(Xa=(52428&Xa)>>>2|(13107&Xa)<<2))>>>4|(3855&Xa)<<4))>>>8|(255&Xa)<<8)>>>1}var Kl=function(e,t,i){for(var r=e.length,o=0,c=new vi(t);r>o;++o)++c[e[o]-1];var f,l=new vi(t);for(o=0;t>o;++o)l[o]=l[o-1]+c[o-1]<<1;for(f=new vi(r),o=0;r>o;++o)f[o]=AC[l[e[o]-1]++]>>>15-e[o];return f},la=new Wi(288);for(as=0;144>as;++as)la[as]=8;for(as=144;256>as;++as)la[as]=9;for(as=256;280>as;++as)la[as]=7;for(as=280;288>as;++as)la[as]=8;var hh=new Wi(32);for(as=0;32>as;++as)hh[as]=5;var mN=Kl(la,9),vN=Kl(hh,5),jC=function(e){return(e/8>>0)+(7&e&&1)},RC=function(e,t,i){(i==null||i>e.length)&&(i=e.length);var r=new(e instanceof vi?vi:e instanceof So?So:Wi)(i-t);return r.set(e.subarray(t,i)),r},On=function(e,t,i){var r=t/8>>0;e[r]|=i<<=7&t,e[r+1]|=i>>>8},El=function(e,t,i){var r=t/8>>0;e[r]|=i<<=7&t,e[r+1]|=i>>>8,e[r+2]|=i>>>16},om=function(e,t){for(var i=[],r=0;e.length>r;++r)e[r]&&i.push({s:r,f:e[r]});var o=i.length,c=i.slice();if(!o)return[new Wi(0),0];if(o==1){var f=new Wi(i[0].s+1);return f[i[0].s]=1,[f,1]}i.sort((function(A,C){return A.f-C.f})),i.push({s:-1,f:25001});var l=i[0],d=i[1],m=0,y=1,v=2;for(i[0]={s:-1,f:l.f+d.f,l,r:d};y!=o-1;)l=i[i[v].f>i[m].f?m++:v++],d=i[m!=y&&i[v].f>i[m].f?m++:v++],i[y++]={s:-1,f:l.f+d.f,l,r:d};var S=c[0].s;for(r=1;o>r;++r)c[r].s>S&&(S=c[r].s);var w=new vi(S+1),R=xv(i[y-1],w,0);if(R>t){r=0;var x=0,g=R-t,b=1<<g;for(c.sort((function(A,C){return w[C.s]-w[A.s]||A.f-C.f}));o>r;++r){var p=c[r].s;if(t>=w[p])break;x+=b-(1<<R-w[p]),w[p]=t}for(x>>>=g;x>0;){var _=c[r].s;t>w[_]?x-=1<<t-w[_]++-1:++r}for(;r>=0&&x;--r){var k=c[r].s;w[k]==t&&(--w[k],++x)}R=t}return[new Wi(w),R]},xv=function(e,t,i){return e.s==-1?Math.max(xv(e.l,t,i+1),xv(e.r,t,i+1)):t[e.s]=i},c1=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new vi(++t),r=0,o=e[0],c=1,f=function(d){i[r++]=d},l=1;t>=l;++l)if(e[l]==o&&l!=t)++c;else{if(!o&&c>2){for(;c>138;c-=138)f(32754);c>2&&(f(c>10?c-11<<5|28690:c-3<<5|12305),c=0)}else if(c>3){for(f(o),--c;c>6;c-=6)f(8304);c>2&&(f(c-3<<5|8208),c=0)}for(;c--;)f(o);c=1,o=e[l]}return[i.subarray(0,r),t]},kl=function(e,t){for(var i=0,r=0;t.length>r;++r)i+=e[r]*t[r];return i},Cv=function(e,t,i){var r=i.length,o=jC(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]=i[c];return 8*(o+4+r)},u1=function(e,t,i,r,o,c,f,l,d,m,y){On(t,y++,i),++o[256];for(var v=om(o,15),S=v[0],w=v[1],R=om(c,15),x=R[0],g=R[1],b=c1(S),p=b[0],_=b[1],k=c1(x),A=k[0],C=k[1],N=new vi(19),j=0;p.length>j;++j)N[31&p[j]]++;for(j=0;A.length>j;++j)N[31&A[j]]++;for(var M=om(N,7),O=M[0],B=M[1],q=19;q>4&&!O[o1[q-1]];--q);var V,J,ee,W,Q=m+5<<3,ie=kl(o,la)+kl(c,hh)+f,I=kl(o,S)+kl(c,x)+f+14+3*q+kl(N,O)+(2*N[16]+3*N[17]+7*N[18]);if(ie>=Q&&I>=Q)return Cv(t,y,e.subarray(d,d+m));if(On(t,y,1+(ie>I)),y+=2,ie>I){V=Kl(S,w),J=S,ee=Kl(x,g),W=x;var P=Kl(O,B);for(On(t,y,_-257),On(t,y+5,C-1),On(t,y+10,q-4),y+=14,j=0;q>j;++j)On(t,y+3*j,O[o1[j]]);y+=3*q;for(var D=[p,A],H=0;2>H;++H){var U=D[H];for(j=0;U.length>j;++j)On(t,y,P[L=31&U[j]]),y+=O[L],L>15&&(On(t,y,U[j]>>>5&127),y+=U[j]>>>12)}}else V=mN,J=la,ee=vN,W=hh;for(j=0;l>j;++j)if(r[j]>255){var L;El(t,y,V[257+(L=r[j]>>>18&31)]),y+=J[L+257],L>7&&(On(t,y,r[j]>>>23&31),y+=dg[L]);var G=31&r[j];El(t,y,ee[G]),y+=W[G],G>3&&(El(t,y,r[j]>>>5&8191),y+=hg[G])}else El(t,y,V[r[j]]),y+=J[r[j]];return El(t,y,V[256]),y+J[256]},gN=new So([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),_N=(function(){for(var e=new So(256),t=0;256>t;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e})(),lm=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function yN(e,t){t===void 0&&(t={});var i=(function(){var v=4294967295;return{p(S){for(var w=v,R=0;S.length>R;++R)w=_N[255&w^S[R]]^w>>>8;v=w},d(){return 4294967295^v}}})(),r=e.length;i.p(e);var o,c,f,l,d,m=(l=10+((o=t).filename&&o.filename.length+1||0),d=8,(function(v,S,w,R,x,g){var b=v.length,p=new Wi(R+b+5*(1+Math.floor(b/7e3))+x),_=p.subarray(R,p.length-x),k=0;if(!S||8>b)for(var A=0;b>=A;A+=65535){var C=A+65535;b>C?k=Cv(_,k,v.subarray(A,C)):(_[A]=!0,k=Cv(_,k,v.subarray(A,b)))}else{for(var N=gN[S-1],j=N>>>13,M=8191&N,O=(1<<w)-1,B=new vi(32768),q=new vi(O+1),V=Math.ceil(w/3),J=2*V,ee=function(Ze){return(v[Ze]^v[Ze+1]<<V^v[Ze+2]<<J)&O},W=new So(25e3),Q=new vi(288),ie=new vi(32),I=0,P=0,D=(A=0,0),H=0,U=0;b>A;++A){var L=ee(A),G=32767&A,se=q[L];if(B[G]=se,q[L]=G,A>=H){var Y=b-A;if((I>7e3||D>24576)&&Y>423){k=u1(v,_,0,W,Q,ie,P,D,U,A-U,k),D=I=P=0,U=A;for(var F=0;286>F;++F)Q[F]=0;for(F=0;30>F;++F)ie[F]=0}var le=2,ae=0,X=M,te=G-se&32767;if(Y>2&&L==ee(A-te))for(var ue=Math.min(j,Y)-1,me=Math.min(32767,A),je=Math.min(258,Y);me>=te&&--X&&G!=se;){if(v[A+le]==v[A+le-te]){for(var Oe=0;je>Oe&&v[A+Oe]==v[A+Oe-te];++Oe);if(Oe>le){if(le=Oe,ae=te,Oe>ue)break;var Le=Math.min(te,Oe-2),at=0;for(F=0;Le>F;++F){var Ee=A-te+F+32768&32767,qe=Ee-B[Ee]+32768&32767;qe>at&&(at=qe,se=Ee)}}}te+=(G=se)-(se=B[G])+32768&32767}if(ae){W[D++]=268435456|wv[le]<<18|l1[ae];var We=31&wv[le],it=31&l1[ae];P+=dg[We]+hg[it],++Q[257+We],++ie[it],H=A+le,++I}else W[D++]=v[A],++Q[v[A]]}}k=u1(v,_,!0,W,Q,ie,P,D,U,A-U,k)}return RC(p,0,R+jC(k)+x)})(c=e,(f=t).level==null?6:f.level,f.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(c.length)))):12+f.mem,l,d)),y=m.length;return(function(v,S){var w=S.filename;if(v[0]=31,v[1]=139,v[2]=8,v[8]=2>S.level?4:S.level==9?2:0,v[9]=3,S.mtime!=0&&lm(v,4,Math.floor(new Date(S.mtime||Date.now())/1e3)),w){v[3]=8;for(var R=0;w.length>=R;++R)v[R+10]=w.charCodeAt(R)}})(m,t),lm(m,y-8,i.d()),lm(m,y-4,r),m}var bN=!!Vm||!!Jv,TC="text/plain",Bd=!1,NC=(e,t)=>{var i=e.split("#"),r=i[1],o=i[0].split("?"),c=o[0],f=o[1];if(!f)return e;var l=f.split("&").filter((d=>d.split("=")[0]!==t)).join("&");return c+(l?"?"+l:"")+(r?"#"+r:"")},kh=function(e,t,i){var r;i===void 0&&(i=!0);var o=e.split("?"),c=o[0],f=o[1],l=Re({},t),d=(r=f==null?void 0:f.split("&").map((y=>{var v,S=y.split("="),w=S[0],R=i&&(v=l[w])!==null&&v!==void 0?v:S[1];return delete l[w],w+"="+R})))!==null&&r!==void 0?r:[],m=(function(y,v){var S,w;v===void 0&&(v="&");var R=[];return Yt(y,(function(x,g){Me(x)||Me(g)||g==="undefined"||(S=encodeURIComponent((b=>b instanceof File)(x)?x.name:x.toString()),w=encodeURIComponent(g),R[R.length]=w+"="+S)})),R.join(v)})(l);return m&&d.push(m),d.length>0?c+"?"+d.join("&"):c},cm=e=>{if(e.Vr)return e.Vr;var t=e.data,i=e.compression;if(t){if(i===ri.GZipJS){var r=yN((function(l,d){var m=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var y=new Wi(l.length+(l.length>>>1)),v=0,S=function(g){y[v++]=g},w=0;m>w;++w){if(v+5>y.length){var R=new Wi(v+8+(m-w<<1));R.set(y),y=R}var x=l.charCodeAt(w);128>x?S(x):2048>x?(S(192|x>>>6),S(128|63&x)):x>55295&&57344>x?(S(240|(x=65536+(1047552&x)|1023&l.charCodeAt(++w))>>>18),S(128|x>>>12&63),S(128|x>>>6&63),S(128|63&x)):(S(224|x>>>12),S(128|x>>>6&63),S(128|63&x))}return RC(y,0,v)})(oo(t)),{mtime:0});return{contentType:TC,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===ri.Base64){var o=(function(l){return l&&btoa(encodeURIComponent(l).replace(/%([0-9A-F]{2})/g,((d,m)=>String.fromCharCode(parseInt(m,16)))))})(oo(t)),c=(l=>"data="+encodeURIComponent(typeof l=="string"?l:oo(l)))(o);return{contentType:"application/x-www-form-urlencoded",body:c,estimatedSize:new Blob([c]).size}}var f=oo(t);return{contentType:"application/json",body:f,estimatedSize:new Blob([f]).size}}},MC=e=>{var t,i,r=()=>e.transport==="sendBeacon"?{url:kh(e.url,{compression:ri.Base64}),encodedBody:cm(Re({},e,{compression:ri.Base64,Vr:void 0}))}:{url:NC(e.url,"compression"),encodedBody:cm(Re({},e,{compression:void 0,Vr:void 0}))};try{t=cm(e)}catch(o){if(Nb(e.compression,yo(e.url,"compression")))return De.error("Failed to gzip request body, sending uncompressed payload",o),r();throw o}return t&&Nb(e.compression,yo(e.url,"compression"))&&!((i=t.body)instanceof ArrayBuffer?Wm(new Uint8Array(i)):ArrayBuffer.isView(i)&&Wm(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Bd=!0,r()):{url:e.url,encodedBody:t}},DC=e=>{try{return MC(e)}catch(t){return De.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},SN=(function(){var e=rs((function*(t){var i=oo(t.data),r=yield(function(c,f,l){return Gm.apply(this,arguments)})(i,Bt.DEBUG,{rethrow:!0});if(!r)return t;var o=yield r.arrayBuffer();return Re({},t,{Vr:{contentType:TC,body:o,estimatedSize:o.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),wN=/Failed to fetch|NetworkError|Load failed/i,OC=e=>{var t=DC(e);if(t){var i=t.url,r=t.encodedBody,o=r??{},c=o.contentType,f=o.body,l=o.estimatedSize,d=new Headers;Yt(e.headers,(function(R,x){d.append(x,R)})),c&&d.append("Content-Type",c);var m=null,y=!1;if(Eb){var v=new Eb;m={signal:v.signal,timeout:setTimeout((()=>{var R,x;y=!0,v.abort((R=e.timeout,(x=new Error("PostHog request timed out"+(R?" after "+R+"ms":""))).name="AbortError",x))}),e.timeout)}}var S=R=>{y&&(R==null?void 0:R.name)==="AbortError"||(x=>(x==null?void 0:x.name)==="TypeError"&&wN.test((x==null?void 0:x.message)||""))(R)?De.warn(R):De.error(R),e.callback==null||e.callback({statusCode:0,error:R})};try{var w;Jv(i,Re({method:(e==null?void 0:e.method)||"GET",headers:d,keepalive:e.method==="POST"&&!e.Wr&&52428.8>(l||0),body:f,signal:(w=m)==null?void 0:w.signal},e.fetchOptions)).then((R=>R.text().then((x=>{var g={statusCode:R.status,text:x};if(R.status===200)try{g.json=JSON.parse(x)}catch(b){De.error(b)}e.callback==null||e.callback(g)})))).catch(S).finally((()=>m?clearTimeout(m.timeout):null))}catch(R){m&&clearTimeout(m.timeout),S(R)}}},Ev=e=>{try{var t,i=MC(e),r=i.url,o=i.encodedBody,c=o??{},f=c.body,l=c.estimatedSize;if(!f)return;var d=f instanceof Blob?f:new Blob([f],{type:c.contentType});if(ai.sendBeacon(r,d))return;var m=rt(e.data)?e.data:(t=e.data)==null?void 0:t.batch;if(rt(m)&&m.length>1&&(l??0)>16384){var y=Math.ceil(m.length/2),v=S=>rt(e.data)?S:Re({},e.data,{batch:S});return Ev(Re({},e,{data:v(m.slice(0,y))})),void Ev(Re({},e,{data:v(m.slice(y))}))}De.warn("Beacon of ~"+(l??0)+" bytes was rejected by the browser, falling back to fetch"),OC(Re({},e,{Wr:!0}))}catch(S){De.warn("Beacon send failed",S)}},d1=(e,t,i,r)=>{var o=r==="query"?t==="POST"?"sent_at":"_":void 0;return kh(i===ri.GZipJS?NC(e,"compression"):e,Re({},o?{[o]:Date.now().toString()}:{},i===ri.GZipJS?{}:{compression:i}))},Hd=[];Jv&&Hd.push({transport:"fetch",method:OC}),Vm&&Hd.push({transport:"XHR",method(e){var t=DC(e);if(t){var i=new Vm,r=t.encodedBody;i.open(e.method||"GET",t.url,!0);var o=r??{},c=o.contentType,f=o.body;Yt(e.headers,(function(l,d){i.setRequestHeader(d,l)})),c&&i.setRequestHeader("Content-Type",c),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(i.readyState===4){var l={statusCode:i.status,text:i.responseText};if(i.status===200)try{l.json=JSON.parse(i.responseText)}catch{}e.callback==null||e.callback(l)}},i.send(f)}}}),ai!=null&&ai.sendBeacon&&Hd.push({transport:"sendBeacon",method:Ev});var kv=3e3;class xN{constructor(t,i){this.Zr=!0,this.Gr=[],this.Qr=hn((i==null?void 0:i.flush_interval_ms)||kv,250,5e3,De.createLogger("flush interval"),kv),this.Jr=t}enqueue(t){this.Gr.push(t),this.Kr||this.Yr()}unload(){this.Xr();var t=this.Gr.length>0?this.ti():{},i=Object.values(t);[...i.filter((r=>r.url.indexOf("/e")===0)),...i.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.ei(Re({},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 i=this.ti(),r=function(){var c=i[o],f=new Date().getTime();c.data&&rt(c.data)&&Yt(c.data,(l=>{l.offset=Math.abs(l.timestamp-f),delete l.timestamp})),t.ei(c)};for(var o in i)r()}}),this.Qr))}ei(t){try{this.Jr(t)}catch(i){De.error(i)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ti(){var t={};return Yt(this.Gr,(i=>{var r,o=i,c=(o?o.batchKey:null)||o.url;Me(t[c])&&(t[c]=Re({},o,{data:[]})),(r=t[c].data)==null||r.push(o.data)})),this.Gr=[],t}}var CN=["retriesPerformedSoFar"];class EN{constructor(t){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=t,this.Gr=[],this.ni=!0,!Me(_e)&&"onLine"in _e.navigator&&(this.ni=_e.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},us(_e,"online",this.si),us(_e,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(t){var i=t.retriesPerformedSoFar,r=ux(t,CN);Bn(i)&&(r.url=kh(r.url,{retry_count:i})),this._instance._send_request(Re({},r,{callback:o=>{if(o.statusCode!==200&&(400>o.statusCode||o.statusCode>=500)){if((o.statusCode===0?3:10)>(i??0))return void this.Ot(Re({retriesPerformedSoFar:i},r));o.statusCode===0&&De.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(i??0)+" retries.")}r.callback==null||r.callback(o)}}))}Ot(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var r=(function(f){var l=3e3*Math.pow(2,f),d=l/2,m=Math.min(18e5,l),y=Math.random()-.5;return Math.ceil(m+y*(m-d))})(i),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)"),De.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(),i=[],r=this.Gr.filter((c=>t>c.retryAt||(i.push(c),!1)));if(this.Gr=i,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,Me(_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 i=t.requestOptions;try{this._instance._send_request(Re({},i,{transport:"sendBeacon"}))}catch(r){De.error(r)}}this.Gr=[]}}class kN{constructor(t){this.hi=()=>{var i,r,o,c;this.di||(this.di={});var f=this.scrollElement(),l=this.scrollY(),d=f?Math.max(0,f.scrollHeight-f.clientHeight):0,m=l+((f==null?void 0:f.clientHeight)||0),y=(f==null?void 0:f.scrollHeight)||0;this.di.lastScrollY=Math.ceil(l),this.di.maxScrollY=Math.max(l,(i=this.di.maxScrollY)!==null&&i!==void 0?i:0),this.di.maxScrollHeight=Math.max(d,(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(y,(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(){us(_e,"scroll",this.hi,{capture:!0}),us(_e,"scrollend",this.hi,{capture:!0}),us(_e,"resize",this.hi)}scrollElement(){if(!this.ci)return _e==null?void 0:_e.document.documentElement;var t=rt(this.ci)?this.ci:[this.ci];for(var i of t){var r=_e==null?void 0:_e.document.querySelector(i);if(r)return r}}vi(t){var i=t==="y"?"scrollTop":"scrollLeft";if(this.ci){var r=this.scrollElement();return r&&r[i]||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 AN=e=>SC(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 h1{constructor(t,i,r,o){this.fi=c=>{var f=this.pi();if(!f||f.sessionId!==c){var l={sessionId:c,props:this.gi(this._instance)};this.mi.register({[pv]:l})}},this._instance=t,this.yi=i,this.mi=r,this.gi=o||AN,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[pv]}getSetOnceProps(){var t,i=(t=this.pi())==null?void 0:t.props;return i?"r"in i?wC(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return Yt(og(this.getSetOnceProps()),((i,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+Km(r)]=i})),t}}class fg{on(t,i){return this.bi[t]||(this.bi[t]=[]),this.bi[t].push(i),()=>{this.bi[t]=this.bi[t].filter((r=>r!==i))}}emit(t,i){for(var r of this.bi[t]||[])r(i);for(var o of this.bi["*"]||[])o(t,i)}constructor(){this.bi={}}}var Al=os("[SessionId]");class f1{on(t,i){return this.wi.on(t,i)}constructor(t,i,r){var o;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new fg,this.Mi=(m,y)=>!(!Bn(m)||!Bn(y))&&Math.abs(m-y)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===qn)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=i||Un,this.Ri=r||Un;var c=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*hn(this.Te.session_idle_timeout_seconds||1800,60,36e3,Al.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 f=Ws.F(this.Oi),l=Ws.F(this.Fi);f&&!l?this.Ii=f:Ws.D(this.Oi),Ws.A(this.Fi,!0)}if((o=this.Te.bootstrap)!=null&&o.sessionID)try{var d=(m=>{var y=this.Te.bootstrap.sessionID.replace(/-/g,"");if(y.length!==32)throw new Error("Not a valid UUID");if(y[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(y.substring(0,12),16)})();this.$i(this.Te.bootstrap.sessionID,new Date().getTime(),d)}catch(m){Al.error("Invalid sessionID in bootstrap",m)}this.Li()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Me(this.ki)&&(this.ki=[]),this.ki.push(t),this.Ti&&t(this.Ti,this.Ii),()=>{this.ki=this.ki.filter((i=>i!==t))}}Ai(){return this.Te.persistence!=="memory"&&!this.mi.yr&&Ws.N()}Di(t){t!==this.Ii&&(this.Ii=t,this.Ai()&&Ws.A(this.Oi,t))}Ni(){return this.Ii?this.Ii:this.Ai()?Ws.F(this.Oi):null}qi(t){var i=this.xi;return!oi(i)&&!oi(t)&&5e3>Math.abs(t-i)}$i(t,i,r){var o=i!==this._sessionActivityTimestamp,c=!(t!==this.Ti||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=i,this.Ti=t,c&&!o||c&&this.qi(i)||(this.xi=i,this.mi.register({[ao]:[i,t,r]}))}ji(){var t,i=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return Bn(i)&&i>0}Bi(){this.ji()?this.mi.refreshKey(ao):(this.mi.flush(),this.mi.load())}Hi(){var t;if(!oi(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Bi();var i=this.Ui();i[1]===this.Ti&&i[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[ao]:[this._sessionActivityTimestamp,(t=this.Ti)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var t=this.Ui()[0],i=Bn(t)?t:0,r=Bn(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,r)}Vi(t){return this.Bi(),this.Mi(t,this.zi())}Ui(){var t=this.mi.props[ao];return rt(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(ah,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Li(){this.Si=()=>{this.Hi(),this.Ai()&&Ws.D(this.Fi)},us(_e,ah,this.Si,{capture:!1})}checkAndGetSessionAndWindowId(t,i){if(t===void 0&&(t=!1),i===void 0&&(i=null),this.Te.cookieless_mode===qn)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||new Date().getTime(),o=this.Ui(),c=o[1],f=o[2],l=this.zi(),d=this.Ni(),m=Bn(f)&&Math.abs(r-f)>864e5,y=!1,v=!1,S=!c,w=c,R=!S&&!t&&this.Mi(r,l);if(R){(R=this.Vi(r))||Al.info("cross-tab refresh kept the session alive",{sessionId:c});var x=this.Ui();c=x[1],f=x[2]}S||R||m?(c=this.Ei(),d=this.Ri(),Al.info("new session ID generated",{sessionId:c,windowId:d,changeReason:{noSessionId:S,activityTimeout:R,sessionPastMaximumLength:m}}),f=r,y=!0):(d||(d=this.Ri(),y=!0),(v=c!==w)&&(Al.info("adopted cross-tab session id",{sessionId:c,windowId:d}),y=!0));var g=Bn(l)&&t&&!m?l:r,b=Bn(f)?f:new Date().getTime();this.Di(d),this.$i(c,g,b),t||this.Pi();var p={noSessionId:S,activityTimeout:R,sessionPastMaximumLength:m,crossTabAdoption:v};return y&&this.ki.forEach((_=>_(c,d,p))),{sessionId:c,windowId:d,sessionStartTimestamp:b,changeReason:y?p: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 $C=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&Db(i,t))return!0;try{var r=e==null?void 0:e.userAgentData;if(r!=null&&r.brands&&r.brands.some((o=>Db(o==null?void 0:o.brand,t))))return!0}catch{}return!!e.webdriver};function LC(){return(LC=rs((function*(){var e=ai==null?void 0:ai.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),i=t==null?void 0:t.model;return Kt(i)&&i.length>0?i:void 0}catch(r){return void De.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",r)}}))).apply(this,arguments)}var fh=function(e,t){if(!(function(i){try{new RegExp(i)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function um(e,t,i){return oo({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var IC={exact:(e,t)=>t.some((i=>e.some((r=>i===r)))),is_not:(e,t)=>t.every((i=>e.every((r=>i!==r)))),regex:(e,t)=>t.some((i=>e.some((r=>fh(i,r))))),not_regex:(e,t)=>t.every((i=>e.every((r=>!fh(i,r))))),icontains:(e,t)=>t.map(ju).some((i=>e.map(ju).some((r=>i.includes(r))))),not_icontains:(e,t)=>t.map(ju).every((i=>e.map(ju).every((r=>!i.includes(r))))),gt:(e,t)=>t.some((i=>{var r=parseFloat(i);return!isNaN(r)&&e.some((o=>r>parseFloat(o)))})),lt:(e,t)=>t.some((i=>{var r=parseFloat(i);return!isNaN(r)&&e.some((o=>r<parseFloat(o)))}))},ju=e=>e.toLowerCase();function PC(e,t){return!e||Object.entries(e).every((i=>{var r=i[1],o=t==null?void 0:t[i[0]];if(Me(o)||oi(o))return!1;var c=[String(o)],f=IC[r.operator];return!!f&&f(r.values,c)}))}var Av="custom",p1="i.posthog.com",jN=/^\/static\//;class RN{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,i=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+p1,".posthog.com")),i==="https://app.posthog.com"?"https://us.posthog.com":i}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":Av),this.Zi[this.apiHost]}Gi(t){if(jN.test(t)){var i=this.instance.config.asset_host;if(typeof i=="string")return i.trim().replace(/\/$/,"")||void 0}}endpointFor(t,i){if(i===void 0&&(i=""),i&&(i=i[0]==="/"?i:"/"+i),t==="ui")return this.uiHost+i;if(t==="flags")return this.flagsApiHost+i;if(t==="assets"){var r=this.Gi(i);if(r)return""+r+i}if(this.region===Av)return this.apiHost+i;var o=p1+i;switch(t){case"assets":return"https://"+this.region+"-assets."+o;case"api":return"https://"+this.region+"."+o}}}function BC(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var qt=os("[Surveys]"),HC="seenSurvey_",zC=e=>{try{var t=(i=>((r,o)=>""+HC+(function(c){return c.current_iteration&&c.current_iteration>0?c.id+"_"+c.current_iteration:c.id})(o))(0,i))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(i){qt.error("Failed to persist survey seen state",i)}},TN=[rm.Popover,rm.Widget,rm.API],NN={ignoreConditions:!1,ignoreDelay:!1,displayType:Sv.Popover},MN=os("[PostHog ExternalIntegrations]"),DN={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class ON{constructor(t){this._instance=t}tr(t,i){var r;(r=Ge.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,t,(o=>{if(o)return MN.error("failed to load script",o);i()}))}startIfEnabledOrStop(){var t=this,i=function(){var c,f,l,d=r[0],m=r[1];!m||(c=Ge.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[d]||t.tr(DN[d],(()=>{var y;(y=Ge.__PosthogExtensions__)==null||(y=y.integrations)==null||(y=y[d])==null||y.start(t._instance)})),!m&&(f=Ge.__PosthogExtensions__)!=null&&(f=f.integrations)!=null&&f[d]&&((l=Ge.__PosthogExtensions__)==null||(l=l.integrations)==null||(l=l[d])==null||l.stop())};for(var r of Object.entries((o=this._instance.config.integrations)!==null&&o!==void 0?o:{})){var o;i()}}}class $N{constructor(t,i){this.it=t,this.Qi=i,this.Ji=new Map,this.Ki=!1}add(t){var i=this;return rs((function*(){if(i.Ki)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.Ji.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.Ji.set(t.name,t);try{var r=t.setup(i.Qi);r&&(yield r)}catch(c){var o=i.Ji.get(t.name)===t;o&&i.Ji.delete(t.name),i.it.error('Failed to set up browser extension "'+t.name+'"',c),o&&i.Yi(t)}}))()}dispose(){if(!this.Ki){this.Ki=!0;var t=Array.from(this.Ji.values()).reverse();for(var i of(this.Ji.clear(),t))this.Yi(i)}}Yi(t){try{var i=t.dispose==null?void 0:t.dispose();i&&Ri(i.then)&&i.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 LN{constructor(t){this._instance=t}get(t){var i;return(i=this._instance.persistence)==null?void 0:i.get_property(t)}set(t,i){var r;(r=this._instance.persistence)==null||r.set_property(t,i)}remove(t){var i;(i=this._instance.persistence)==null||i.unregister(t)}}var m1="extensionsRemoteConfig";class IN{constructor(t){this.Ki=!1,this.instance=t,this.it=De.createLogger("[BrowserExtensions]"),this.Xi=t.tn,this.kv=new LN(t),this.onEvent=i=>Au(this.instance.on("eventCaptured",(r=>{try{i({event:r.event,properties:r.properties})}catch(o){this.it.error("Browser extension event listener failed",o)}}))),this.onRemoteConfig=i=>{if(this.Ki)return Au((()=>{}));var r=c=>{try{i(c)}catch(f){this.it.error("Browser extension remote config listener failed",f)}},o=this.instance.en.on(m1,r);return this.Xi&&r(this.Xi),Au(o)},this.rn=new $N(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(Ql))!==null&&t!==void 0?t:this.distinctId}get groups(){return this.instance.getGroups()}get session(){try{var t,i,r,o,c=(t=this.instance.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:(i=c==null?void 0:c.sessionId)!==null&&i!==void 0?i:"",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,i,r){var o=this;return rs((function*(){r?o.instance.capture(t,i,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):o.instance.capture(t,i)}))()}registerDynamicEventProperties(t){return Au(this.instance.nn(t))}handleRemoteConfig(t){this.Ki||(this.Xi=t,this.instance.en.emit(m1,t))}sendRequest(t,i){var r=this;return rs((function*(){var o;i===void 0&&(i={});var c=r.instance.requestRouter.endpointFor((o=i.target)!==null&&o!==void 0?o:"api",t),f={method:i.method,url:i.query?kh(c,i.query):c,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport};return i.transport==="sendBeacon"?(r.instance._send_request(f),{statusCode:202}):new Promise((l=>{f.callback=l,r.instance._send_request(f)}))}))()}dispose(){this.Ki||(this.Ki=!0,this.rn.dispose())}}var Yl={},dm=0,ph=()=>{},v1='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',jl="Surveys module not available",g1="sanitize_properties is deprecated. Use before_send instead",UC="Invalid value for property_denylist config: ",PN=["token","distinct_id",Yx],ro="posthog",qC=!bN&&(mi==null?void 0:mi.indexOf("MSIE"))===-1&&(mi==null?void 0:mi.indexOf("Mozilla"))===-1,hm=e=>{var t;return Re({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:B3(Ie==null?void 0:Ie.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ph,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:ws&&Kt(ws==null?void 0:ws.search)&&ws.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(i){De.error("Bad HTTP status: "+i.statusCode+" "+i.text)},get_device_id:i=>i,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:_v,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:kv},error_tracking:{},_onCapture:ph},(i=>({rageclick:i&&i>="2026-05-30"?{content_ignorelist:J3,ignore_text_selection:!0}:!i||"2025-11-30">i||{content_ignorelist:!0},capture_pageview:!i||"2025-05-24">i||"history_change",session_recording:i&&i>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:i&&i>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:i&&i>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:i&&i>="2026-01-30"?"head":"body",internal_or_test_user_hostname:i&&i>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:i&&i>="2026-05-30"?250:0,split_storage:!(!i||"2026-05-30">i),detect_google_search_app:!(!i||"2026-05-30">i),disable_capture_url_hashes:!(!i||"2026-06-25">i)}))(e))},BN=[["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"]],_1=e=>{var t={};for(var i of BN){var r=i[0],o=i[1];Me(e[r])||(t[o]=e[r])}var c=Zt({},t,e),f=e.__preview_external_dependency_versioned_paths;return Me(f)||(Me(e.strict_script_versioning)&&(c.strict_script_versioning=!!f),Kt(f)&&Me(e.asset_host)&&(c.asset_host=f)),rt(e.property_blacklist)&&(Me(e.property_denylist)?c.property_denylist=e.property_blacklist:rt(e.property_denylist)?c.property_denylist=[...e.property_blacklist,...e.property_denylist]:De.error(UC+e.property_denylist)),c};class HN{constructor(){this.__forceAllowLocalhost=!1}get sn(){return this.__forceAllowLocalhost}set sn(t){De.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Vi{an(t,i){if(t){var r=this.Ji.indexOf(t);r!==-1&&this.Ji.splice(r,1)}return this.Ji.push(i),i.initialize==null||i.initialize(),i}ln(){return this.config.cookieless_mode===qn||this.config.cookieless_mode===sa&&this.consent.isRejected()}get decideEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)==null?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)==null?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.webPerformance=new HN,this.un=!1,this.version=Bt.LIB_VERSION,this.en=new fg,this.Ji=[],this.hn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=hm(),this.SentryIntegration=rN,this.sentryIntegration=r=>(function(o,c){var f=pC(o,c);return{name:fC,processEvent:l=>f(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 kN(this),this.pageViewManager=new i1(this),this.rateLimiter=new pN(this),this.requestRouter=new RN(this),this.consent=new W3(this),this.externalIntegrations=new ON(this);var i=(t=Vi.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(r,o,c)=>{var f=Kt(r)?{[r]:o}:r;this.setPersonProperties(f),c==null||c({})},set_once:(r,o,c)=>{var f=Kt(r)?{[r]:o}:r;this.setPersonProperties(void 0,f),c==null||c({})}},this.on("eventCaptured",(r=>De.info('send "'+(r==null?void 0:r.event)+'"',r)))}init(t,i,r){if(r&&r!==ro){var o,c=(o=Yl[r])!==null&&o!==void 0?o:new Vi;return c._init(t,i,r),Yl[r]=c,Yl[ro][r]=c,c}return this._init(t,i,r)}_init(t,i,r){var o,c;i===void 0&&(i={});var f=Kt(t)?t.trim():"";if(!f)return De.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=hm(i.defaults),i.debug=this.pn(i.debug),this.gn=i,this.mn=[],i.person_profiles?this.vn=i.person_profiles:i.process_person&&(this.vn=i.process_person);var l=hm(i.defaults),d=_1(i),m=Zt({},l,d,{name:r,token:f});ns(l.rageclick)&&ns(d.rageclick)&&(m.rageclick=Zt({},l.rageclick,d.rageclick)),ns(l.session_recording)&&ns(d.session_recording)&&(m.session_recording=Zt({},l.session_recording,d.session_recording)),this.set_config(m),this.config.on_xhr_error&&De.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:ri.GZipJS;var y=this.yn();this.persistence=new nm(this.config,y),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new nm(Re({},this.config,{persistence:"sessionStorage"}),y,!1);var v=Re({},this.persistence.props),S=Re({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.bn=new xN((k=>this._n(k)),this.config.request_queue_config),this.wn=new EN(this),this.__request_queue=[];var w=this.ln();if(w||(this.sessionManager=new f1(this),this.sessionPropsManager=new h1(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(De.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.xn(w)}),0)):(De.info("Initializing extensions synchronously"),this.xn(w)),Bt.DEBUG=Bt.DEBUG||this.config.debug,Bt.DEBUG&&De.info("Starting in debug mode",{this:this,config:i,thisC:Re({},this.config),p:v,s:S}),!this.config.identity_distinct_id||(o=i.bootstrap)!=null&&o.distinctID||(i.bootstrap=Re({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((c=i.bootstrap)==null?void 0:c.distinctID)!==void 0){var R=i.bootstrap.distinctID,x=this.get_distinct_id(),g=this.persistence.get_property(Fi);if(i.bootstrap.isIdentifiedID&&x!=null&&x!==R&&g===Ka)this.identify(R);else if(i.bootstrap.isIdentifiedID&&x!=null&&x!==R&&g===qr)De.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(Un()),p=i.bootstrap.isIdentifiedID?b:R;this.persistence.set_property(Fi,i.bootstrap.isIdentifiedID?qr:Ka),this.register({distinct_id:R,$device_id:p})}}if(w)this.register_once({distinct_id:wu,$device_id:null},"");else if(!this.get_distinct_id()){var _=this.config.get_device_id(Un());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(Fi,Ka)}return us(_e,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?(function(k,A){var C=k.config.segment;if(!C)return A();(function(N,j){var M=N.config.segment;if(!M)return j();var O=q=>{var V=()=>q.anonymousId()||Un();N.config.get_device_id=V,q.id()&&(N.register({distinct_id:q.id(),$device_id:V()}),N.persistence.set_property(Fi,qr)),j()},B=M.user();"then"in B&&Ri(B.then)?B.then(O):O(B)})(k,(()=>{C.register((N=>{typeof Promise<"u"&&Promise.resolve||sm.warn("This browser does not have Promise support, and can not use the segment integration");var j=(M,O)=>{if(!O)return M;M.event.userId||M.event.anonymousId===N.get_distinct_id()||(sm.info("No userId set, resetting PostHog"),N.reset()),M.event.userId&&M.event.userId!==N.get_distinct_id()&&(sm.info("UserId set, identifying with PostHog"),N.identify(M.event.userId));var B=N.calculateEventProperties(O,M.event.properties);return M.event.properties=Object.assign({},B,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,no),identify:M=>j(M,Qp),screen:M=>j(M,"$screen")}})(k)).then((()=>{A()}))}))})(this,(()=>this.kn())):this.kn(),Ri(this.config._onCapture)&&this.config._onCapture!==ph&&(De.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&De.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 LC.apply(this,arguments)})().then((k=>{k&&this.register({[Jp]:k})})).catch(ph),this}xn(t){var i,r,o,c,f,l,d,m,y=performance.now(),v=Re({},Vi.__defaultExtensionClasses,this.config.__extensionClasses),S=[];v.featureFlags&&this.Ji.push(this.featureFlags=(i=this.featureFlags)!==null&&i!==void 0?i:new v.featureFlags(this)),v.exceptions&&this.Ji.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new v.exceptions(this)),v.historyAutocapture&&this.Ji.push(this.historyAutocapture=new v.historyAutocapture(this)),v.tracingHeaders&&this.Ji.push(this.tracingHeaders=new v.tracingHeaders(this)),v.siteApps&&this.Ji.push(this.siteApps=new v.siteApps(this)),v.sessionRecording&&!t&&this.Ji.push(this.sessionRecording=new v.sessionRecording(this)),this.config.disable_scroll_properties||S.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),v.autocapture&&this.Ji.push(this.autocapture=new v.autocapture(this)),v.surveys&&this.Ji.push(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new v.surveys(this)),v.logs&&this.Ji.push(this.logs=(c=this.logs)!==null&&c!==void 0?c:new v.logs(this)),v.metrics&&this.Ji.push(this.metrics=(f=this.metrics)!==null&&f!==void 0?f:new v.metrics(this)),v.conversations&&this.Ji.push(this.conversations=(l=this.conversations)!==null&&l!==void 0?l:new v.conversations(this)),v.productTours&&this.Ji.push(this.productTours=new v.productTours(this)),v.heatmaps&&this.Ji.push(this.heatmaps=new v.heatmaps(this)),v.webVitalsAutocapture&&this.Ji.push(this.webVitalsAutocapture=new v.webVitalsAutocapture(this)),v.exceptionObserver&&this.Ji.push(this.exceptionObserver=new v.exceptionObserver(this)),v.deadClicksAutocapture&&this.Ji.push(this.deadClicksAutocapture=new v.deadClicksAutocapture(this,nN)),v.toolbar&&this.Ji.push(this.toolbar=(d=this.toolbar)!==null&&d!==void 0?d:new v.toolbar(this)),v.experiments&&this.Ji.push(this.experiments=(m=this.experiments)!==null&&m!==void 0?m:new v.experiments(this)),this.Ji.forEach((w=>{w.initialize&&S.push((()=>{w.initialize==null||w.initialize()}))})),S.push((()=>{if(this.Sn){var w=this.Sn;this.Sn=void 0,this.Ji.forEach((R=>R.onRemoteConfig==null?void 0:R.onRemoteConfig(w)))}})),this.Cn(S,y)}Cn(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.Cn(t,i)}),0);var r=t.shift();if(r)try{r()}catch(c){De.error("Error initializing extension:",c)}}var o=Math.round(performance.now()-i);this.register_for_session({[Xx]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Jx]:o}),this.config.__preview_deferred_init_extensions&&De.info("PostHog extensions initialized ("+o+"ms)")}Br(t){var i;if(!Ie||!Ie.body)return De.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=st(o.supportedCompression,ri.GZipJS)?ri.GZipJS:st(o.supportedCompression,ri.Base64)?ri.Base64:void 0),(r=o.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=o.analytics.endpoint)}this.set_config({person_profiles:this.vn?this.vn:_v}),(i=this.Mn)==null||i.handleRemoteConfig(t),this.Ji.forEach((c=>c.onRemoteConfig==null?void 0:c.onRemoteConfig(t)))}kn(){try{this.config.loaded(this)}catch(r){De.critical("`loaded` function failed",r)}if(this.In(),this.config.internal_or_test_user_hostname&&ws!=null&&ws.hostname){var t=ws.hostname,i=this.config.internal_or_test_user_hostname;(typeof i=="string"?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.ln())&&this.Tn()}),1),this.En=new CC(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()&&xu(this.__request_queue,(t=>this._n(t))),this.__request_queue=[],this.In()}_handle_unload(){var t,i,r,o,c;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),(i=this.metrics)==null||i.flush("sendBeacon"),this.config.request_batching?(this.Rn()&&this.capture(Zp),(r=this.logs)==null||r.flushLogs("sendBeacon"),(o=this.bn)==null||o.unload(),(c=this.wn)==null||c.unload()):this.Rn()&&this.capture(Zp,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?qC?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=Re({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(Me(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(i=>{var r,o,c,f=Re({},i);f.timeout=f.timeout||6e4;var l,d,m,y,v,S=(r=f.transport)!==null&&r!==void 0?r:"fetch";S==="sendBeacon"&&Me(f.compression)&&f.data&&(f.compression=ri.Base64),f.method==="POST"&&f.data&&(f.timestampMode==="capture-body"?f.data={api_key:(d=(v=(y=rt(l=f.data)?l:[l])[0])==null||(m=v.properties)==null?void 0:m.token)!==null&&d!==void 0?d:v==null?void 0:v.token,batch:y,sent_at:new Date().toISOString()}:f.timestampMode==="body"&&(f.data=(function(x,g){return g===void 0&&(g=new Date().toISOString()),rt(x)?x.map((b=>Re({},b,{sent_at:g}))):Re({},x,{sent_at:g})})(f.data))),f.url=d1(f.url,f.method,f.compression,f.timestampMode);var w=Hd.filter((x=>!f.disableTransport||!x.transport||!f.disableTransport.includes(x.transport))),R=(o=(c=(function(x,g){for(var b=0;x.length>b;b++)if(x[b].transport===S)return x[b]})(w))==null?void 0:c.method)!==null&&o!==void 0?o:w[0].method;if(!R)throw new Error("No available transport method");S!=="sendBeacon"&&f.data&&f.compression===ri.GZipJS&&zT&&typeof Promise<"u"&&!Bd?SN(f).then((x=>{R(x)})).catch((x=>{if(Mb(x))return Bd=!0,void R(Re({},f,{compression:void 0,url:d1(i.url,i.method,void 0,i.timestampMode)}));(g=>{if(!g||typeof g!="object")return!1;var b="name"in g?String(g.name):"";return Mb(g)||b===dx})(x)&&(Bd=!0),R(f)})):R(f)})(Re({},t,{callback:i=>{var r,o;this.rateLimiter.checkForLimiting(i),400>i.statusCode||(r=(o=this.config).on_request_error)==null||r.call(o,i),t.callback==null||t.callback(i)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}_n(t){this.wn?this.wn.retriableRequest(t):this._send_request(t)}_execute_array(t){dm++;try{var i,r=[],o=[],c=[];xu(t,(l=>{if(l)if(rt(i=l[0]))c.push(l);else if(Ri(l))try{l.call(this)}catch(d){De.error("Error executing queued PostHog call",l,d)}else rt(l)&&i==="alias"?r.push(l):rt(l)&&i.indexOf("capture")!==-1&&Ri(this[i])?c.push(l):o.push(l)}));var f=function(l,d){xu(l,(function(m){try{if(rt(m[0])){var y=d;Yt(m,(function(v){y=y[v[0]].apply(y,v.slice(1))}))}else d[m[0]].apply(d,m.slice(1))}catch(v){De.error("Error executing queued PostHog call",m,v)}}))};f(r,this),f(o,this),f(c,this)}finally{dm--}}push(t){if(dm>0&&rt(t)&&Kt(t[0])){var i=Vi.prototype[t[0]];Ri(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,i,r){var o,c,f,l,d,m,y;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.bn){if(this.is_capturing())if(!Me(t)&&Kt(t)){var v=!this.config.opt_out_useragent_filter&&this._is_bot();if(!v||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 w={};for(var R of this.hn.slice())try{Zt(w,R())}catch(P){De.error("Failed to produce browser extension event properties",P)}i=Re({},w,i??{})}var x;(o=i)!=null&&o.$current_url&&!Kt((c=i)==null?void 0:c.$current_url)&&(De.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),(x=i)==null||delete x.$current_url),t!=="$exception"||r!=null&&r.Pn||De.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 g=new Date,b=(r==null?void 0:r.timestamp)||g,p=Ib(r==null?void 0:r.uuid,Un),_={uuid:p,event:t,properties:this.calculateEventProperties(t,i||{},b,p)};t===no&&this.config.__preview_capture_bot_pageviews&&v&&(_.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(th)===!0;r!=null&&r.$set&&!k&&(_.$set=r==null?void 0:r.$set);var A=r==null?void 0:r.$unset;A&&(_.$unset=A);var C,N,j,M=k?void 0:this.On(r==null?void 0:r.$set_once,t!==Ub,t===Qp);if(M&&(_.$set_once=M),r!=null&&r._noTruncate||(l=this.config.properties_string_max_length,d=_,m=P=>Kt(P)?P.slice(0,l):P,y=new Set,_=(function P(D,H){if(D!==Object(D))return m?m(D):D;if(!y.has(D)){var U;if(y.add(D),rt(D))U=[],xu(D,(G=>{U.push(P(G))}));else{var L={};Yt(D,((G,se)=>{y.has(G)||(L[se]=P(G))})),U=L}return U}})(d)),_.timestamp=b,Me(r==null?void 0:r.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=g),k&&(_.properties=(function(P,D){D===void 0&&(D=[]);var H={},U=L=>{P[L]!==void 0&&(H[L]=P[L])};return UT.forEach(U),D.forEach(U),H})(_.properties,PN)),t===Vn.DISMISSED||t===Vn.SENT){var O,B,q=(O=i)==null?void 0:O[am.SURVEY_ID],V=(B=i)==null?void 0:B[am.SURVEY_ITERATION];zC({id:q,current_iteration:V}),_.$set=Re({},_.$set,{[(C={id:q,current_iteration:V},N=t===Vn.SENT?"responded":"dismissed",j="$survey_"+N+"/"+C.id,C.current_iteration&&C.current_iteration>0&&(j="$survey_"+N+"/"+C.id+"/"+C.current_iteration),j)]:!0})}else t===Vn.SHOWN&&(_.$set=Re({},_.$set,{[am.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===fN.SHOWN){var J,ee=(J=i)==null?void 0:J[r1.TOUR_TYPE];ee&&(_.$set=Re({},_.$set,{[r1.TOUR_LAST_SEEN_DATE+"/"+ee]:new Date().toISOString()}))}var W=Re({},_.properties.$set,_.$set);if(Sr(W)||this.setPersonPropertiesForFlags(W),!lt(this.config.before_send)){var Q=this.Rt(_);if(!Q)return;(_=Q).uuid=Ib(_.uuid,Un)}this.en.emit("eventCaptured",_);var ie=(f=r==null?void 0:r._url)!==null&&f!==void 0?f:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),I={method:"POST",url:ie,data:_,compression:"best-available",timestampMode:(r==null?void 0:r._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(ie)?"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(I):this.bn.enqueue(I),_}De.critical("This capture call is ignored due to client rate limiting.")}}else De.error("No event name provided to posthog.capture")}else De.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}Fn(){var t;return(t=this.Mn)!==null&&t!==void 0?t:this.Mn=new IN(this)}nn(t){this.hn.push(t);var i=!0;return()=>{if(i){i=!1;var r=this.hn.indexOf(t);r!==-1&&this.hn.splice(r,1)}}}calculateEventProperties(t,i,r,o,c){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;var f=c?void 0:this.persistence.remove_event_timer(t),l=Re({},i);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.ln()&&(l[Yx]=!0),t==="$snapshot"){var d=Re({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=d.distinct_id,(!Kt(l.distinct_id)&&!Gs(l.distinct_id)||Ym(l.distinct_id))&&De.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var m,y=(function(_,k,A,C){var N,j,M,O;if(C===void 0&&(C=!1),!mi)return{};var B,q=_?[...bo,...k||[]]:[],V=(function(ue){for(var me=0;$b.length>me;me++){var je=$b[me],Oe=je[1],Le=je[0].exec(ue),at=Le&&(Ri(Oe)?Oe(Le,ue):Oe);if(at)return at}return["",""]})(mi),J=V[0],ee=V[1],W=(B=typeof navigator<"u"?navigator:void 0)!=null&&B.brave?{brave:!0}:{},Q={};Me(A)||(Q.detectGoogleSearchApp=A);var ie={},I=(N=navigator)==null||(N=N.userAgentData)==null?void 0:N.platform,P=(j=navigator)==null?void 0:j.maxTouchPoints,D=_e==null||(M=_e.screen)==null?void 0:M.width,H=_e==null||(O=_e.screen)==null?void 0:O.height,U=_e==null?void 0:_e.devicePixelRatio;Me(I)||(ie.userAgentDataPlatform=I),Me(P)||(ie.maxTouchPoints=P),Me(D)||(ie.screenWidth=D),Me(H)||(ie.screenHeight=H),Me(U)||(ie.devicePixelRatio=U);var L,G,se,Y,F,le,ae,X,te=Zt(og({$os:J,$os_version:ee,$browser:$x(mi,navigator.vendor,W,Q),$device:Lb(mi),$device_type:(G=mi,se=ie,X=Lb(G),X===gx||X===vx||X==="Kobo"||X==="Kindle Fire"||X===Tx?vo:X===Jl||X===ho||X===Zl||X===Jm?"Console":X===yx?"Wearable":X?Mi:(se==null?void 0:se.userAgentDataPlatform)==="Android"&&((Y=se==null?void 0:se.maxTouchPoints)!==null&&Y!==void 0?Y:0)>0?600>Math.min((F=se==null?void 0:se.screenWidth)!==null&&F!==void 0?F:0,(le=se==null?void 0:se.screenHeight)!==null&&le!==void 0?le:0)/((ae=se==null?void 0:se.devicePixelRatio)!==null&&ae!==void 0?ae:1)?Mi:vo:"Desktop"),$timezone:xC(),$timezone_offset:uN()}),{$current_url:sc(C?xr(ws==null?void 0:ws.href):ws==null?void 0:ws.href,q,ic),$host:ws==null?void 0:ws.host,$pathname:ws==null?void 0:ws.pathname,$raw_user_agent:mi.length>1e3?mi.substring(0,997)+"...":mi,$browser_version:o3(mi,navigator.vendor,W,Q),$browser_language:n1(),$browser_language_prefix:(L=n1(),typeof L=="string"?L.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:Bt.LIB_NAME,$lib_version:Bt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Bt.SDK_DIST_CHANNEL&&(te.$sdk_dist_channel=Bt.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 v=this.sessionManager.checkAndGetSessionAndWindowId(c,r.getTime()),S=v.windowId;l.$session_id=v.sessionId,l.$window_id=S}this.sessionPropsManager&&Zt(l,this.sessionPropsManager.getSessionProps());try{var w;this.sessionRecording&&Zt(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=(w=this.wn)==null?void 0:w.length}catch(_){l.$sdk_debug_error_capturing_properties=String(_)}if(this.requestRouter.region===Av&&(l.$lib_custom_api_host=this.config.api_host),m=t!==no||c?t!==Zp||c?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),l=Zt(l,m),t===no&&Ie&&(l.title=Ie.title),!Me(f)){var R=r.getTime()-f;l.$duration=parseFloat((R/1e3).toFixed(3))}mi&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var x=this.persistence.properties(),g=this.sessionPersistence.properties();Yt(["$referrer","$referring_domain"],(_=>{_ in x&&delete g[_]})),(l=Zt({},y,x,g,l)).$is_identified=this._isIdentified(),rt(this.config.property_denylist)?Yt(this.config.property_denylist,(function(_){delete l[_]})):De.error(UC+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(De.error(g1),l=b(l,t));var p=this.An();return l.$process_person_profile=p,p&&!c&&this.$n("_calculate_event_properties"),l}On(t,i,r){var o;if(i===void 0&&(i=!0),r===void 0&&(r=!1),!this.persistence||!this.An()||this.un&&!r)return t;var c=this.persistence.get_initial_props(),f=(o=this.sessionPropsManager)==null?void 0:o.getSetOnceProps(),l=Zt({},c,f||{},t||{}),d=this.config.sanitize_properties;return d&&(De.error(g1),l=d(l,"$set_once")),i&&(this.un=!0),Sr(l)?void 0:l}register(t,i){var r;(r=this.persistence)==null||r.register(t,i)}register_once(t,i,r){var o;(o=this.persistence)==null||o.register_once(t,i,r)}register_for_session(t){var i;(i=this.sessionPersistence)==null||i.register(t)}unregister(t){var i;(i=this.persistence)==null||i.unregister(t)}unregister_for_session(t){var i;(i=this.sessionPersistence)==null||i.unregister(t)}Ln(t,i){this.register({[t]:i})}getFeatureFlag(t,i){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return(t=(i=this.featureFlags)==null?void 0:i.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,i){var r,o;return(r=(o=this.featureFlags)==null?void 0:o.isFeatureEnabled(t,i))!==null&&r!==void 0?r:i==null?void 0:i.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,i,r){var o;(o=this.featureFlags)==null||o.updateFlags(t,i,r)}updateEarlyAccessFeatureEnrollment(t,i,r){var o;(o=this.featureFlags)==null||o.updateEarlyAccessFeatureEnrollment(t,i,r)}getEarlyAccessFeatures(t,i,r){var o;return i===void 0&&(i=!1),(o=this.featureFlags)==null?void 0:o.getEarlyAccessFeatures(t,i,r)}on(t,i){return this.en.on(t,i)}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:jl}),()=>{})}onSessionId(t){var i,r;return(i=(r=this.sessionManager)==null?void 0:r.onSessionId(t))!==null&&i!==void 0?i:()=>{}}getSurveys(t,i){i===void 0&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:jl})}getActiveMatchingSurveys(t,i){i===void 0&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:jl})}renderSurvey(t,i){var r;(r=this.surveys)==null||r.renderSurvey(t,i)}displaySurvey(t,i){var r;i===void 0&&(i=NN),(r=this.surveys)==null||r.displaySurvey(t,i)}cancelPendingSurvey(t){var i;(i=this.surveys)==null||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,r;return(i=(r=this.surveys)==null?void 0:r.canRenderSurvey(t))!==null&&i!==void 0?i:{visible:!1,disabledReason:jl}}canRenderSurveyAsync(t,i){var r,o;return i===void 0&&(i=!1),(r=(o=this.surveys)==null?void 0:o.canRenderSurveyAsync(t,i))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:jl})}Dn(t){return!t||Ym(t)?(De.critical("Unique user id has not been set in posthog.identify"),!1):t===wu?(De.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())||(De.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,i,r){if(!this.__loaded||!this.persistence)return De.uninitializedWarning("posthog.identify");if(Gs(t)&&(t=t.toString(),De.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(Ql)||this.register_once({$had_persisted_distinct_id:!0,$device_id:o},""),t!==o&&t!==this.get_property(Pl)&&(this.unregister(Pl),this.register({distinct_id:t}));var c,f=(this.persistence.get_property(Fi)||Ka)===Ka,l=t!==o,d=!l&&f;if(l&&f)this.persistence.set_property(Fi,qr),this.setPersonPropertiesForFlags({$set:i||{},$set_once:r||{}},!1),this.capture(Qp,{distinct_id:t,$anon_distinct_id:o},{$set:i||{},$set_once:r||{}}),this.fn=um(t,i,r),(c=this.featureFlags)==null||c.setAnonymousDistinctId(o);else if(d){this.persistence.set_property(Fi,qr);var m=i||{},y=r||{};this.setPersonPropertiesForFlags({$set:m,$set_once:y},!1),this.capture("$set",{$set:m,$set_once:y}),this.fn=um(t,i,r)}else(i||r)&&this.setPersonProperties(i,r);l?(this.reloadFeatureFlags(),this.unregister(Wl)):d&&(i||r)&&this.reloadFeatureFlags()}}setPersonProperties(t,i){if((t||i)&&this.$n("posthog.setPersonProperties")){var r=um(this.get_distinct_id(),t,i);this.fn!==r?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.fn=r):De.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,r=(rt(t)?t:[t]).filter((o=>Kt(o)&&o.length>0));r.length!==0&&this.$n("posthog.unsetPersonProperties")&&((i=this.featureFlags)==null||i.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.fn=null)}group(t,i,r){if(t&&i){var o=this.getGroups(),c=o[t]!==i;if(c&&this.resetGroupPropertiesForFlags(t),this.register({$groups:Re({},o,{[t]:i})}),c||r){var f={$group_type:t,$group_key:i};r&&(f.$group_set=r),this.capture(Ub,f)}r&&this.setGroupPropertiesForFlags({[t]:r}),c&&!r&&this.reloadFeatureFlags()}else De.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var r;i===void 0&&(i=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t){var i;t===void 0&&(t=!0),(i=this.featureFlags)==null||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i){var r;i===void 0&&(i=!0),this.$n("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;(i=this.featureFlags)==null||i.resetGroupPropertiesForFlags(t)}reset(t){var i,r,o,c,f,l,d,m,y,v;if(De.info("reset"),!this.__loaded)return De.uninitializedWarning("posthog.reset");var S,w=this.get_property(Ql),R=this.get_property(Jp),x=this.get_property(aa);if(this.consent.reset(),(i=this.persistence)==null||i.clear(),(r=this.sessionPersistence)==null||r.clear(),Me(x)||(S=this.persistence)==null||S.register({[aa]:x}),(o=this.surveys)==null||o.reset(),(c=this.En)==null||c.stop(),(f=this.featureFlags)==null||f.reset(),(l=this.conversations)==null||l.reset(),(d=this.logs)==null||d.reset(),(m=this.metrics)==null||m.reset(),(y=this.persistence)==null||y.set_property(Fi,Ka),(v=this.sessionManager)==null||v.resetSessionId(),this.fn=null,this.config.cookieless_mode===qn)this.register_once({distinct_id:wu,$device_id:null},"");else{var g=this.config.get_device_id(Un());this.register_once({distinct_id:g,$device_id:t?g:w},""),t||Me(R)||this.register({[Jp]:R})}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 i=this;return rs((function*(){var r,o,c,f,l,d,m;i.__loaded?((r=i.En)==null||r.stop(),(o=i.Mn)==null||o.dispose(),(c=i.logs)==null||c.flushLogs("sendBeacon"),(f=i.metrics)==null||f.flush("sendBeacon"),(l=i.bn)==null||l.unload(),(d=i.wn)==null||d.unload(),(m=i.featureFlags)==null||m.destroy()):De.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,i){var r;this.config.identity_distinct_id=t,this.config.identity_hash=i,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,i;return(t=(i=this.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var i=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=i.sessionStartTimestamp,o=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i.sessionId);if(t!=null&&t.withTimestamp&&r){var c,f=(c=t.timestampLookBack)!==null&&c!==void 0?c:10;if(!r)return o;o+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-f,0)}return o}alias(t,i){return t===this.get_property(qx)?(De.critical("Attempting to create alias for existing People user - aborting."),-2):this.$n("posthog.alias")?(Me(i)&&(i=this.get_distinct_id()),t!==i?(this.Ln(Pl,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(De.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=Re({},this.config);if(ns(t)){var r,o,c,f,l,d,m,y,v,S,w;Zt(this.config,_1(t));var R=this.yn();(r=this.persistence)==null||r.update_config(this.config,i,R),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new nm(Re({},this.config,{persistence:"sessionStorage"}),R,!1);var x=this.pn(this.config.debug);Qi(x)&&(this.config.debug=x),Qi(this.config.debug)&&(this.config.debug?(Bt.DEBUG=!0,Jt.N()&&Jt.A("ph_debug",!0),De.info("set_config",{config:t,oldConfig:i,newConfig:Re({},this.config)})):(Bt.DEBUG=!1,Jt.N()&&Jt.D("ph_debug"))),(o=this.exceptionObserver)==null||o.onConfigChange(),(c=this.exceptions)==null||c.onConfigChange(),(f=this.sessionRecording)==null||f.startIfEnabledOrStop(),(l=this.tracingHeaders)==null||l.startIfEnabledOrStop(),(d=this.autocapture)==null||d.startIfEnabled(),(m=this.heatmaps)==null||m.startIfEnabled(),(y=this.exceptionObserver)==null||y.startIfEnabledOrStop(),(v=this.deadClicksAutocapture)==null||v.startIfEnabledOrStop(),(S=this.surveys)==null||S.loadIfEnabled(),this.jn(),(w=this.externalIntegrations)==null||w.startIfEnabledOrStop()}}_overrideSDKInfo(t,i){Bt.LIB_NAME=t,Bt.LIB_VERSION=i}startSessionRecording(t){var i,r,o,c,f,l=t===!0,d={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(d).some(Boolean)&&((i=this.sessionManager)==null||i.checkAndGetSessionAndWindowId(),d.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),d.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),d.url_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("url")),d.event_trigger&&((f=this.sessionRecording)==null||f.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,i){if(this.exceptions){var r=new Error("PostHog syntheticException"),o=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(Re({},o,i))}}addExceptionStep(t,i){var r;(r=this.exceptions)==null||r.addExceptionStep(t,i)}captureLog(t){var i;(i=this.logs)==null||i.captureLog(t)}get logger(){var t,i;return(t=(i=this.logs)==null?void 0:i.logger)!==null&&t!==void 0?t:Vi.Bn}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,r;return(i=(r=this.toolbar)==null?void 0:r.loadToolbar(t))!==null&&i!==void 0&&i}get_property(t){var i;return(i=this.persistence)==null?void 0:i.props[t]}getSessionProperty(t){var i;return(i=this.sessionPersistence)==null?void 0:i.props[t]}toString(){var t,i=(t=this.config.name)!==null&&t!==void 0?t:ro;return i!==ro&&(i=ro+"."+i),i}_isIdentified(){var t,i;return((t=this.persistence)==null?void 0:t.get_property(Fi))===qr||((i=this.sessionPersistence)==null?void 0:i.get_property(Fi))===qr}An(){var t,i;return!(this.config.person_profiles==="never"||this.config.person_profiles===_v&&!this._isIdentified()&&Sr(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Pl])&&((i=this.persistence)==null||(i=i.props)==null||!i[nh]))}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"?(De.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ln(nh,!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!==sa)}jn(){var t,i,r,o,c=this.yn();return((t=this.persistence)==null?void 0:t.yr)!==c&&((r=this.persistence)==null||r.set_disabled(c)),((i=this.sessionPersistence)==null?void 0:i.yr)!==c&&((o=this.sessionPersistence)==null||o.set_disabled(c)),c}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==qn){if(this.ln()){var r,o,c,f,l;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(o=this.pageViewManager)==null||o.destroy(),this.sessionManager=new f1(this),this.pageViewManager=new i1(this),this.persistence&&(this.sessionPropsManager=new h1(this,this.sessionManager,this.persistence));var d,m=(c=(f=this.config.__extensionClasses)==null?void 0:f.sessionRecording)!==null&&c!==void 0?c:(l=Vi.__defaultExtensionClasses)==null?void 0:l.sessionRecording;m&&(this.sessionRecording=this.an(this.sessionRecording,new m(this)),this.tn&&((d=this.sessionRecording)==null||d.onRemoteConfig==null||d.onRemoteConfig(this.tn)))}var y,v;this.consent.optInOut(!0),this.jn(),this.In(),(i=this.sessionRecording)==null||i.startIfEnabledOrStop(),this.config.cookieless_mode==sa&&((y=this.surveys)==null||y.loadIfEnabled()),(Me(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((v=t==null?void 0:t.captureEventName)!==null&&v!==void 0?v:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Tn()}else De.warn(v1)}opt_out_capturing(){var t,i,r;this.config.cookieless_mode!==qn?(this.config.cookieless_mode===sa&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.jn(),this.config.cookieless_mode===sa&&(this.register({distinct_id:wu,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(i=this.sessionManager)==null||i.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Tn(),this.In())):De.warn(v1)}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===qn||(this.config.cookieless_mode===sa?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.jn()}_is_bot(){return ai?$C(ai,this.config.custom_blocked_useragents):void 0}Tn(){Ie&&(Ie.visibilityState==="visible"?this.dn||(this.dn=!0,this.capture(no,{title:Ie.title},{send_instantly:!0}),this.cn&&(Ie.removeEventListener(rh,this.cn),this.cn=null)):this.cn||(this.cn=this.Tn.bind(this),us(Ie,rh,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?(De.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(i,r,o,c,f){var l=r in i&&!lt(i[r]),d=o in i&&!lt(i[o]);return l?i[r]:!!d&&(f&&f.warn("Config field '"+o+"' is deprecated. Please use '"+r+"' instead. The old field will be removed in a future major version."),i[o])})(t,"advanced_disable_flags","advanced_disable_decide",0,De)}Rt(t){var i;if(lt(this.config.before_send))return t;var r=Object.keys((i=t.properties)!==null&&i!==void 0?i:{}).filter(YT),o=rt(this.config.before_send)?this.config.before_send:[this.config.before_send],c=t;for(var f of o){if(c=f(c),lt(c)){var l="Event '"+t.event+"' was rejected in beforeSend function";return KT(t.event)?De.warn(l+". This can cause unexpected behavior."):De.info(l),null}c.properties&&!Sr(c.properties)||De.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var d of r)if(c.properties&&lt(c.properties[d]))return De.warn("Event '"+t.event+"' had its '"+d+"' 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,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(r)})}pn(t){var i=Qi(t)&&!t,r=Jt.N()&&Jt.q("ph_debug")==="true";return!i&&(!!r||t)}}Vi.__defaultExtensionClasses={},Vi.Bn=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=I3(e.prototype[t[i]])})(Vi,["identify"]);class y1{constructor(t){this.disabled=t===!1;var i=ns(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,r){if(this.disabled)return!1;var o=this.clicks[this.clicks.length-1];if(o&&Math.abs(t-o.x)+Math.abs(i-o.y)<this.thresholdPx&&this.timeoutMs>r-o.timestamp){if(this.clicks.push({x:t,y:i,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:r}];return!1}}var fm="$copy_autocapture",pm=os("[AutoCapture]");function mm(e,t){return t.length>e?t.slice(0,e)+"...":t}function zN(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Cr(t));return t}function UN(e,t){var i,r,o=t.e,c=t.maskAllElementAttributes,f=t.maskAllText,l=t.elementAttributeIgnoreList,d=t.elementsChainAsString,m=t.disableCaptureUrlHashes;if(!Cr(e))return{props:{}};for(var y=[e],v=new Set([e]),S=e;S.parentNode&&!Ti(S,"body")&&aC>y.length;)if(rC(S.parentNode)){var w=S.parentNode.host;if(v.has(w))break;v.add(w),y.push(w),S=w}else{if(!Cr(S.parentNode)||v.has(S.parentNode))break;v.add(S.parentNode),y.push(S.parentNode),S=S.parentNode}var R,x,g=[],b={},p=!1,_=!1;if(Yt(y,(j=>{var M=bv(j);if(Ti(j,"a")){var O=j.getAttribute("href");p=!!(M&&O&&Gl(O))&&(m?xr(O):O)}st(lh(j),"ph-no-capture")&&(_=!0),g.push((function(q,V,J,ee,W){W===void 0&&(W=!1);var Q=q.tagName.toLowerCase(),ie={tag_name:Q};cg.indexOf(Q)>-1&&!J&&(ie.$el_text=Q.toLowerCase()==="a"||Q.toLowerCase()==="button"?mm(1024,e1(q)):mm(1024,tc(q)));var I=lh(q);I.length>0&&(ie.classes=I.filter((function(U){return U!==""}))),Yt(q.attributes,(function(U){var L;if((!dC(q)||["name","id","class","aria-label"].indexOf(U.name)!==-1)&&(ee==null||!ee.includes(U.name))&&!V&&Gl(U.value)&&(!Kt(L=U.name)||L.substring(0,10)!=="_ngcontent"&&L.substring(0,7)!=="_nghost")){var G=U.value;U.name==="class"&&(G=lg(G).join(" ")),ie["attr__"+U.name]=mm(1024,U.name==="href"&&W?xr(G):G)}}));for(var P=1,D=1,H=q;H=zN(H);)P++,H.tagName===q.tagName&&D++;return ie.nth_child=P,ie.nth_of_type=D,ie})(j,c,f,l,m));var B=(function(q){if(!bv(q))return{};var V={};return Yt(q.attributes,(function(J){if(J.name&&J.name.indexOf("data-ph-capture-attribute")===0){var ee=J.name.replace("data-ph-capture-attribute-",""),W=J.value;ee&&W&&Gl(W)&&(V[ee]=W)}})),V})(j);Zt(b,B)})),_)return{props:{},explicitNoCapture:_};if(f||(g[0].$el_text=Ti(e,"a")||Ti(e,"button")?e1(e):tc(e)),p){var k,A;g[0].attr__href=p;var C=(k=ch(p))==null?void 0:k.host,N=_e==null||(A=_e.location)==null?void 0:A.host;C&&N&&C!==N&&(R=p)}return{props:Zt({$event_type:o.type,$ce_version:1},d?{}:{$elements:g},{$elements_chain:(x=g,(function(j){return j.map((M=>{var O,B,q="";if(M.tag_name&&(q+=M.tag_name),M.attr_class)for(var V of(M.attr_class.sort(),M.attr_class))q+="."+V.replace(/"/g,"");var J=Re({},M.text?{text:M.text}:{},{"nth-child":(O=M.nth_child)!==null&&O!==void 0?O:0,"nth-of-type":(B=M.nth_of_type)!==null&&B!==void 0?B:0},M.href?{href:M.href}:{},M.attr_id?{attr_id:M.attr_id}:{},M.attributes),ee={};return Pd(J).sort(((W,Q)=>W[0].localeCompare(Q[0]))).forEach((W=>{var Q=W[1];return ee[t1(W[0].toString())]=t1(Q.toString())})),(q+=":")+Pd(ee).map((W=>W[0]+'="'+W[1]+'"')).join("")})).join(";")})((function(j){return j.map((M=>{var O,B,q={text:(O=M.$el_text)==null?void 0:O.slice(0,400),tag_name:M.tag_name,href:(B=M.attr__href)==null?void 0:B.slice(0,2048),attr_class:sN(M),attr_id:M.attr__id,nth_child:M.nth_child,nth_of_type:M.nth_of_type,attributes:{}};return Pd(M).filter((V=>V[0].indexOf("attr__")===0)).forEach((V=>q.attributes[V[0]]=V[1])),q}))})(x)))},(i=g[0])!=null&&i.$el_text?{$el_text:(r=g[0])==null?void 0:r.$el_text}:{},R&&o.type==="click"?{$external_click_url:R}:{},b)}}var Rl=os("[ExceptionAutocapture]"),b1=()=>{},qN=os("[TracingHeaders]"),Gr=os("[Web Vitals]"),S1=9e5,w1="disabled",x1="lazy_loading",Tl="awaiting_config",Ru="missing_config";os("[SessionRecording]"),os("[SessionRecording]");var jv="[SessionRecording]",$n=os(jv),FN=os("[Heatmaps]");function vm(e){return ns(e)&&"clientX"in e&&"clientY"in e&&Gs(e.clientX)&&Gs(e.clientY)}var gm=os("[Product Tours]"),_m=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(ng))},VN=["$set_once","$set"],cn=os("[SiteApps]"),C1="Error while initializing PostHog app with config id ";function Ja(e,t,i){if(lt(e))return!1;switch(i){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 WN{constructor(t){this.Hn=new fg,this.Un=(i,r)=>this.zn(i,r)&&this.Vn(i,r)&&this.Wn(i,r)&&this.Zn(i,r),this.zn=(i,r)=>r==null||!r.event||(i==null?void 0:i.event)===(r==null?void 0:r.event),this._instance=t,this.Gn=new Set,this.Qn=new Set}init(){var t,i;Me((t=this._instance)==null?void 0:t._addCaptureHook)||(i=this._instance)==null||i._addCaptureHook(((r,o)=>{this.on(r,o)}))}register(t){var i,r;if(!Me((i=this._instance)==null?void 0:i._addCaptureHook)&&(t.forEach((f=>{var l,d;(l=this.Qn)==null||l.add(f),(d=f.steps)==null||d.forEach((m=>{var y;(y=this.Gn)==null||y.add((m==null?void 0:m.event)||"")}))})),(r=this._instance)!=null&&r.autocapture)){var o,c=new Set;t.forEach((f=>{var l;(l=f.steps)==null||l.forEach((d=>{d!=null&&d.selector&&c.add(d==null?void 0:d.selector)}))})),(o=this._instance)==null||o.autocapture.setElementSelectors(c)}}on(t,i){var r;i!=null&&t.length!=0&&(this.Gn.has(t)||this.Gn.has(i.event))&&this.Qn&&((r=this.Qn)==null?void 0:r.size)>0&&this.Qn.forEach((o=>{this.Jn(i,o)&&this.Hn.emit("actionCaptured",o.name)}))}Kn(t){this.onAction("actionCaptured",(i=>t(i)))}Jn(t,i){if((i==null?void 0:i.steps)==null)return!1;for(var r of i.steps)if(this.Un(t,r))return!0;return!1}onAction(t,i){return this.Hn.on(t,i)}Vn(t,i){if(i!=null&&i.url){var r,o=t==null||(r=t.properties)==null?void 0:r.$current_url;if(!o||typeof o!="string"||!Ja(o,i.url,i.url_matching||"contains"))return!1}return!0}Wn(t,i){return!!this.Yn(t,i)&&!!this.Xn(t,i)&&!!this.ts(t,i)}Yn(t,i){var r;if(i==null||!i.href)return!0;var o=this.es(t);if(o.length>0)return o.some((l=>Ja(l.href,i.href,i.href_matching||"exact")));var c,f=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!f&&Ja((c=f.match(/(?::|")href="(.*?)"/))?c[1]:"",i.href,i.href_matching||"exact")}Xn(t,i){var r;if(i==null||!i.text)return!0;var o=this.es(t);if(o.length>0)return o.some((m=>Ja(m.text,i.text,i.text_matching||"exact")||Ja(m.$el_text,i.text,i.text_matching||"exact")));var c,f,l,d=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!d&&(c=(function(m){for(var y,v=[],S=/(?::|")text="(.*?)"/g;!lt(y=S.exec(m));)v.includes(y[1])||v.push(y[1]);return v})(d),f=i.text,l=i.text_matching||"exact",c.some((m=>Ja(m,f,l))))}ts(t,i){var r,o;if(i==null||!i.selector)return!0;var c=t==null||(r=t.properties)==null?void 0:r.$element_selectors;if(c!=null&&c.includes(i.selector))return!0;var f=(t==null||(o=t.properties)==null?void 0:o.$elements_chain)||"";if(i.selector_regex&&f)try{return new RegExp(i.selector_regex).test(f)}catch{return!1}return!1}es(t){var i;return(t==null||(i=t.properties)==null?void 0:i.$elements)==null?[]:t==null?void 0:t.properties.$elements}Zn(t,i){return i==null||!i.properties||i.properties.length===0||PC(i.properties.reduce(((r,o)=>{var c=rt(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 GN{constructor(t){var i;this.rs=[],this._instance=t,this.ns=new Map,this.ss=new Map,this.os=new Map,(i=this._instance)==null||i.onSessionId==null||i.onSessionId((r=>this.ls(r)))}us(t,i){return!!t&&PC(t.propertyFilters,i==null?void 0:i.properties)}hs(t,i){var r=new Map;return t.forEach((o=>{var c;(c=o.conditions)==null||(c=c[i])==null||(c=c.values)==null||c.forEach((f=>{if(f!=null&&f.name){var l=r.get(f.name)||[];l.push(o.id),r.set(f.name,l)}}))})),r}ds(t,i,r){var o=(r===Cl.Activation?this.ns:this.ss).get(t),c=[];return this.cs((f=>{c=f.filter((l=>o==null?void 0:o.includes(l.id)))})),c.filter((f=>{var l,d=(l=f.conditions)==null||(l=l[r])==null||(l=l.values)==null?void 0:l.find((m=>m.name===t));return this.us(d,i)}))}register(t){var i;Me((i=this._instance)==null?void 0:i._addCaptureHook)||(this.vs(t),this.fs(t))}fs(t){var i=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}));i.length!==0&&(this.ps==null&&(this.ps=new WN(this._instance),this.ps.init(),this.ps.Kn((r=>{this.onAction(r)}))),i.forEach((r=>{var o,c,f,l,d;r.conditions&&(o=r.conditions)!=null&&o.actions&&(c=r.conditions)!=null&&(c=c.actions)!=null&&c.values&&((f=r.conditions)==null||(f=f.actions)==null||(f=f.values)==null?void 0:f.length)>0&&((l=this.ps)==null||l.register(r.conditions.actions.values),(d=r.conditions)==null||(d=d.actions)==null||(d=d.values)==null||d.forEach((m=>{if(m&&m.name){var y=this.os.get(m.name);y&&y.push(r.id),this.os.set(m.name,y||[r.id])}})))})))}vs(t){var i,r=t.filter((c=>{var f,l;return((f=c.conditions)==null?void 0:f.events)&&((l=c.conditions)==null||(l=l.events)==null||(l=l.values)==null?void 0:l.length)>0})),o=t.filter((c=>{var f,l;return((f=c.conditions)==null?void 0:f.cancelEvents)&&((l=c.conditions)==null||(l=l.cancelEvents)==null||(l=l.values)==null?void 0:l.length)>0}));r.length===0&&o.length===0||((i=this._instance)==null||i._addCaptureHook(((c,f)=>{this.onEvent(c,f)})),this.ns=this.hs(t,Cl.Activation),this.ss=this.hs(t,Cl.Cancellation))}onEvent(t,i){var r,o,c=this.gs(),f=(i==null||(r=i.properties)==null?void 0:r.$survey_id)||(i==null||(o=i.properties)==null?void 0:o.$product_tour_id);if(f&&this.getActivatedIds().includes(f)){var l=this.ys(t,f);if(l==="consume")return c.info("event consumed activated item, removing it",{event:t,itemId:f}),void this.bs([f]);if(l==="persist")return c.info("shown item promoted to persisted activation",{event:t,itemId:f}),void this._s(f)}if(this.ss.has(t)){var d=this.ds(t,i,Cl.Cancellation);d.length>0&&(c.info("cancel event matched, cancelling items",{event:t,itemsToCancel:d.map((y=>y.id))}),this.bs(d.map((y=>y.id))),d.forEach((y=>this.ws(y.id))))}if(this.ns.has(t)){c.info("event name matched",{event:t,eventPayload:i,items:this.ns.get(t)});var m=this.ds(t,i,Cl.Activation);this.xs(m.map((y=>y.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 i=this.ks();i.includes(t)||(this.Ss([...i,t]),this.Cs())}bs(t){var i=new Set(t);this.rs=this.rs.filter((c=>!i.has(c)));var r=this.Ms(),o=r.filter((c=>!i.has(c)));o.length!==r.length&&(this.Ss(o),o.length===0&&this.Is())}Ms(){var t,i=this.Ts();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[i])||[]}ks(){var t,i,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=(i=this._instance)==null||i.get_session_id==null?void 0:i.get_session_id();return c&&o===c?r:[]}Cs(){var t,i=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();i&&this.Rs(i)}Is(){this.Ps()}ls(t){var i,r=(i=this._instance)==null||(i=i.persistence)==null?void 0:i.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 KN extends GN{constructor(t){super(t)}Ts(){return dv}Es(){return Id}As(){return Vn.SHOWN}cs(t){var i;(i=this._instance)==null||i.getSurveys(t)}ws(t){var i;(i=this._instance)==null||i.cancelPendingSurvey(t)}gs(){return qt}Ss(t){var i;(i=this._instance)==null||(i=i.persistence)==null||i.register({[dv]:t})}Rs(t){var i;(i=this._instance)==null||(i=i.persistence)==null||i.register({[Id]:t})}Ps(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(Id)}Os(){return!1}ys(t,i){var r;this.cs((c=>{r=c.find((f=>f.id===i))}));var o=!r||(function(c){var f;return BC(c)&&!((f=c.conditions)==null||(f=f.events)==null||!f.repeatedActivation)||c.schedule==="always"})(r);return o?t===Vn.SHOWN?"consume":"ignore":t===Vn.SHOWN?"persist":t===Vn.DISMISSED||t===Vn.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Tu="SDK is not enabled or survey functionality is not yet loaded",E1="Disabled. Not loading surveys.",YN=_e!=null&&_e.location?uh(_e.location.hash,"__posthog")||uh(location.hash,"state"):null,k1="_postHogToolbarParams",A1=os("[Toolbar]"),Ts=os("[FeatureFlags]"),Kr=os("[FeatureFlags]",{debugEnabled:!0}),ym=`" failed. Feature flags didn't load in time.`,j1=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},R1=e=>{var t={};for(var i of Pd(e||{})){var r=i[1];r&&(t[i[0]]=r)}return t},un=os("[Error tracking]"),T1="Refusing to render web experiment since the viewer is a likely bot",XN={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>fh(t,e),not_regex:(e,t)=>!fh(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class Js{get Te(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),i.getWebExperiments((o=>{Js.$s("retrieved web experiments from the server"),i.Ls=new Map,o.forEach((c=>{if(c.feature_flag_key){var f;i.Ls&&(Js.$s("setting flag key ",c.feature_flag_key," to web experiment ",c),(f=i.Ls)==null||f.set(c.feature_flag_key,c));var l=i._instance.getFeatureFlag(c.feature_flag_key);Kt(l)&&c.variants[l]&&i.Ds(c.name,l,c.variants[l].transforms)}else if(c.variants)for(var d in c.variants){var m=c.variants[d];Js.Ns(m,i._instance)&&i.Ds(c.name,d,m.transforms)}}))}),r)},this._instance=t,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Js.$s(T1);else if(!this.Te.disable_web_experiments){if(lt(this.Ls))return this.Ls=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Js.$s("applying feature flags",t),t.forEach((i=>{var r;if(this.Ls&&(r=this.Ls)!=null&&r.has(i)){var o,c=this._instance.getFeatureFlag(i),f=(o=this.Ls)==null?void 0:o.get(i);c&&f!=null&&f.variants[c]&&this.Ds(f.name,c,f.variants[c].transforms)}}))}}previewWebExperiment(){var t=Js.getWindowLocation();if(t!=null&&t.search){var i=yo(t==null?void 0:t.search,"__experiment_id"),r=yo(t==null?void 0:t.search,"__experiment_variant");i&&r&&(Js.$s("previewing web experiments "+i+" && "+r),this.getWebExperiments((o=>{this.qs(parseInt(i),r,o)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,r){if(this.Te.disable_web_experiments&&!r)return t([]);var o=this._instance.get_property("$web_experiments");if(o&&!i)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,i,r){var o=r.filter((c=>c.id===t));o&&o.length>0&&(Js.$s("Previewing web experiment ["+o[0].name+"] with variant ["+i+"]"),this.Ds(o[0].name,i,o[0].variants[i].transforms))}static Ns(t,i){return!lt(t.conditions)&&Js.js(t,i)&&Js.Bs(t)}static js(t,i){var r;if(lt(t.conditions)||lt((r=t.conditions)==null?void 0:r.url))return!0;var o=Js.getWindowLocation();if(o){var c,f,l,d=sC(i,o.href);return(c=t.conditions)==null||!c.url||XN[(f=(l=t.conditions)==null?void 0:l.urlMatchType)!==null&&f!==void 0?f:"icontains"](t.conditions.url,d)}return!1}static getWindowLocation(){return _e==null?void 0:_e.location}static Bs(t){var i;if(lt(t.conditions)||lt((i=t.conditions)==null?void 0:i.utm))return!0;var r=gC();if(r.utm_source){var o,c,f,l,d,m,y,v,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,w=(f=t.conditions)==null||(f=f.utm)==null||!f.utm_source||((l=t.conditions)==null||(l=l.utm)==null?void 0:l.utm_source)==r.utm_source,R=(d=t.conditions)==null||(d=d.utm)==null||!d.utm_medium||((m=t.conditions)==null||(m=m.utm)==null?void 0:m.utm_medium)==r.utm_medium,x=(y=t.conditions)==null||(y=y.utm)==null||!y.utm_term||((v=t.conditions)==null||(v=v.utm)==null?void 0:v.utm_term)==r.utm_term;return S&&R&&x&&w}return!1}static $s(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),o=1;i>o;o++)r[o-1]=arguments[o];De.info("[WebExperiments] "+t,r)}Ds(t,i,r){this._is_bot()?Js.$s(T1):i!=="control"?r.forEach((o=>{if(o.selector){var c;Js.$s("applying transform of variant "+i+" for experiment "+t+" ",o);var f=(c=document)==null?void 0:c.querySelectorAll(o.selector);f==null||f.forEach((l=>{var d=l;o.html&&(d.innerHTML=o.html),o.css&&d.setAttribute("style",o.css)}))}})):Js.$s("Control variants leave the page unmodified.")}_is_bot(){return ai&&this._instance?$C(ai,this.Te.custom_blocked_useragents):void 0}}var qi=os("[Conversations]"),Yr="Conversations not available yet.",N1="console",Ah={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&&us(_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,Ts.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||(Ts.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((i=>{var r=i&&typeof i=="string"&&i.trim().length>0;return r||Ts.error("Invalid evaluation context found:",i,"Expected non-empty string"),r})):[]}no(){return this.io().length>0}so(){var e=this.Te.flag_keys;if(!Me(e)){if(rt(e))return e.filter((t=>{var i=t&&typeof t=="string"&&t.trim().length>0;return i||Ts.error("Invalid flag key found:",t,"Expected non-empty string"),i}));Ts.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,i=this._instance.config,r=(e=(t=i.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(r).length){var o,c,f=(o=(c=i.bootstrap)==null?void 0:c.featureFlagPayloads)!==null&&o!==void 0?o:{},l=Object.keys(r).filter((m=>!!r[m])).reduce(((m,y)=>(m[y]=r[y]||!1,m)),{}),d=Object.keys(f).filter((m=>l[m])).reduce(((m,y)=>(f[y]&&(m[y]=f[y]),m)),{});this.receivedFeatureFlags({featureFlags:l,featureFlagPayloads:d})}}updateFlags(e,t,i){var r,o,c=i!=null&&i.merge&&(r=this.Xs(na))!==null&&r!==void 0?r:{},f=i!=null&&i.merge&&(o=this.Xs(Ld))!==null&&o!==void 0?o:{},l=Re({},c,e),d=Re({},f,t),m={};for(var y of Object.entries(l)){var v=y[0],S=y[1];m[v]={key:v,enabled:jb(S),variant:Rb(S),reason:void 0,metadata:Me(d==null?void 0:d[v])?void 0:{id:0,version:void 0,description:void 0,payload:d[v]}}}this.receivedFeatureFlags({flags:m})}get hasLoadedFlags(){return this.Us}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Xs(lv),t=this.Xs(Hn),i=this.Xs(io);if(!i&&!t)return e||{};var r=Zt({},e||{}),o=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var c of o){var f,l,d=r[c],m=t==null?void 0:t[c],y=Me(m)?(f=d==null?void 0:d.enabled)!==null&&f!==void 0&&f:!!m,v=Me(m)?d.variant:typeof m=="string"?m:void 0,S=i==null?void 0:i[c],w=Re({},d,{enabled:y,variant:y?v??(d==null?void 0:d.variant):void 0});y!==(d==null?void 0:d.enabled)&&(w.original_enabled=d==null?void 0:d.enabled),v!==(d==null?void 0:d.variant)&&(w.original_variant=d==null?void 0:d.variant),S&&(w.metadata=Re({},d==null?void 0:d.metadata,{payload:S,original_payload:d==null||(l=d.metadata)==null?void 0:l.payload})),r[c]=w}return this.Hs||(Ts.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:r}),this.Hs=!0),r}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((i=>{var r=e[i];return{key:i,enabled:jb(r),variant:Rb(r),payload:Ab(t[i])}}))}getFlagVariants(){var e=this.Xs(na),t=this.Xs(Hn);if(!t)return e||{};for(var i=Zt({},e),r=Object.keys(t),o=0;r.length>o;o++)i[r[o]]=t[r[o]];return this.Hs||(Ts.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Hs=!0),i}getFlagPayloads(){var e=this.Xs(Ld),t=this.Xs(io);if(!t)return e||{};for(var i=Zt({},e||{}),r=Object.keys(t),o=0;r.length>o;o++)i[r[o]]=t[r[o]];return this.Hs||(Ts.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Hs=!0),i}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 i=this.Te.token,r=this.Xs(Ql),o={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:Re({},((t=this.mi)==null?void 0:t.get_initial_props())||{},this.Xs(ea)||{},{$lib:Bt.LIB_NAME,$lib_version:Bt.LIB_VERSION}),group_properties:this.Xs(ta),timezone:xC()};oi(r)||Me(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();Me(c)||(o.flag_keys=c);var f=!!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:ri.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:d=>{var m,y,v,S=!0;if(this.uo(d.statusCode),d.statusCode===200&&(this.Ws||(this.$anon_distinct_id=void 0),S=!1),this.zs=!1,!o.disable_flags||this.Ws){this.Zs=!S;var w=[];d.error?d.error instanceof Error?w.push(d.error.name==="AbortError"?"timeout":"connection_error"):w.push("unknown_error"):d.statusCode!==200&&w.push("api_error_"+d.statusCode),(m=d.json)!=null&&m.errorsWhileComputingFlags&&w.push("errors_while_computing_flags");var R,x=!((y=d.json)==null||(y=y.quotaLimited)==null||!y.includes("feature_flags"));x&&w.push("quota_limited"),(v=this.mi)==null||v.register({[fv]:w}),x?Ts.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((R=d.json)!==null&&R!==void 0?R:{},S,{partialResponse:f}),this.Ws&&(this.Ws=!1,this.ao()))}}})}}Ys(){return mC(this.Js,3)}uo(e){this.Js=vC(e,this.Js,3,(()=>Ts.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 i;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(i=r==null?void 0:r.variant)!==null&&i!==void 0?i:r==null?void 0:r.enabled}}else Ts.warn('getFeatureFlag for key "'+e+ym)}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 i=this.getFlagVariants(),r=e in i,o=i[e],c=this.getFlagPayloads()[e],f=String(o),l=this.Xs(cv)||void 0,d=this.Xs(ec)||void 0,m=this.Xs(Wl)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var y,v=this._instance.get_session_id(),S=this.Xs(hv);v&&v!==S&&(m={},(y=this.mi)==null||y.register({[Wl]:m,[hv]:v}))}if((t.send_event||!("send_event"in t))&&(!(e in m)||!m[e].includes(f))){var w,R,x,g,b,p,_,k,A,C,N;rt(m[e])?m[e].push(f):m[e]=[f],(w=this.mi)==null||w.register({[Wl]:m});var j=this.getFeatureFlagDetails(e),M=[...(R=this.Xs(fv))!==null&&R!==void 0?R:[]];Me(o)&&M.push("flag_missing");var O={$feature_flag:e,$feature_flag_response:o,$feature_flag_payload:c||null,$feature_flag_request_id:l,$feature_flag_evaluated_at:d,$feature_flag_bootstrapped_response:((x=this.Te.bootstrap)==null||(x=x.featureFlags)==null?void 0:x[e])||null,$feature_flag_bootstrapped_payload:((g=this.Te.bootstrap)==null||(g=g.featureFlagPayloads)==null?void 0:g[e])||null,$used_bootstrap_value:!this.Zs};Me(j==null||(b=j.metadata)==null?void 0:b.has_experiment)||(O.$feature_flag_has_experiment=j.metadata.has_experiment),Me(j==null||(p=j.metadata)==null?void 0:p.version)||(O.$feature_flag_version=j.metadata.version);var B,q=(_=j==null||(k=j.reason)==null?void 0:k.description)!==null&&_!==void 0?_:j==null||(A=j.reason)==null?void 0:A.code;q&&(O.$feature_flag_reason=q),j!=null&&(C=j.metadata)!=null&&C.id&&(O.$feature_flag_id=j.metadata.id),Me(j==null?void 0:j.original_variant)&&Me(j==null?void 0:j.original_enabled)||(O.$feature_flag_original_response=Me(j.original_variant)?j.original_enabled:j.original_variant),j!=null&&(N=j.metadata)!=null&&N.original_payload&&(O.$feature_flag_original_payload=j==null||(B=j.metadata)==null?void 0:B.original_payload),M.length&&(O.$feature_flag_error=M.join(",")),this._instance.capture("$feature_flag_called",O)}if(r)return{key:e,enabled:!!o,variant:typeof o=="string"?o:void 0,payload:Ab(c)}}}else Ts.warn('getFeatureFlagResult for key "'+e+ym)}getRemoteConfigPayload(e,t){var i=this.Te.token,r={distinct_id:this._instance.get_distinct_id(),token:i,person_properties:{$lib:Bt.LIB_NAME,$lib_version:Bt.LIB_VERSION}};this.no()&&(r.evaluation_contexts=this.io());var o=this.so();Me(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:ri.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback(c){var f,l=(f=c.json)==null?void 0:f.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 Ts.warn('isFeatureEnabled for key "'+e+ym),t.defaultValue;var i=this.getFeatureFlag(e,t);return Me(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,i){if(this.mi){this.Us=!0;var r=this.getFlagVariants(),o=this.getFlagPayloads(),c=this.getFlagsWithDetails();(function(f,l,d,m,y,v){d===void 0&&(d={}),m===void 0&&(m={}),y===void 0&&(y={});var S=(j=>{var M=j.flags;return M?(j.featureFlags=Object.fromEntries(Object.keys(M).map((O=>{var B;return[O,(B=M[O].variant)!==null&&B!==void 0?B:M[O].enabled]}))),j.featureFlagPayloads=Object.fromEntries(Object.keys(M).filter((O=>M[O].enabled)).filter((O=>{var B;return(B=M[O].metadata)==null?void 0:B.payload})).map((O=>{var B;return[O,(B=M[O].metadata)==null?void 0:B.payload]})))):j.featureFlags&&Ts.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),j})(f),w=S.flags,R=S.featureFlags,x=S.featureFlagPayloads;if(R){var g=f.requestId,b=f.evaluatedAt;if(rt(R)){Ts.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var p={};if(R)for(var _=0;R.length>_;_++)p[R[_]]=!0;l&&l.register({[$d]:R,[na]:p,[th]:!1})}else{var k=R,A=x,C=w;if(v!=null&&v.partialResponse)k=Re({},d,k),A=Re({},m,A),C=Re({},y,C);else if(f.errorsWhileComputingFlags)if(w){var N=new Set(Object.keys(w).filter((j=>{var M;return!((M=w[j])!=null&&M.failed)})));k=Re({},d,Object.fromEntries(Object.entries(k).filter((j=>N.has(j[0]))))),A=Re({},m,Object.fromEntries(Object.entries(A||{}).filter((j=>N.has(j[0]))))),C=Re({},y,Object.fromEntries(Object.entries(C||{}).filter((j=>N.has(j[0])))))}else k=Re({},d,k),A=Re({},m,A),C=Re({},y,C);l&&l.register(Re({[$d]:Object.keys(R1(k)),[na]:k||{},[Ld]:A||{},[lv]:C||{},[th]:f.minimalFlagCalledEvents===!0},g?{[cv]:g}:{},b?{[ec]:b}:{}))}}})(e,this.mi,r,o,c,i),t||(this.Qs=!1),this.ho(t)}}override(e,t){t===void 0&&(t=!1),Ts.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.mi)return Ts.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.mi.unregister(Hn),this.mi.unregister(io),this.ho(),Kr.info("All overrides cleared");if(rt(e)){var t=j1(e);return this.mi.register({[Hn]:t}),this.ho(),Kr.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var i,r=e;if(this.Hs=!!((i=r.suppressWarning)!==null&&i!==void 0&&i),"flags"in r){if(r.flags===!1)this.mi.unregister(Hn),Kr.info("Flag overrides cleared");else if(r.flags){if(rt(r.flags)){var o=j1(r.flags);this.mi.register({[Hn]:o})}else this.mi.register({[Hn]:r.flags});Kr.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this.mi.unregister(io),Kr.info("Payload overrides cleared")):r.payloads&&(this.mi.register({[io]:r.payloads}),Kr.info("Payload overrides set",{payloads:r.payloads}))),void this.ho()}if(e&&typeof e=="object")return this.mi.register({[Hn]:e}),this.ho(),Kr.info("Flag overrides set",{flags:e});Ts.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Us){var t=this.do(),i=t.flags,r=t.flagVariants;try{e(i,r)}catch(o){Ts.error("Error while running feature flags callback",o)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var r,o=(this.Xs(Hl)||[]).find((d=>d.flagKey===e)),c={["$feature_enrollment/"+e]:t},f={$feature_flag:e,$feature_enrollment:t,$set:c};o&&(f.$early_access_feature_name=o.name),i&&(f.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",f),this.setPersonPropertiesForFlags(c,!1);var l=Re({},this.getFlagVariants(),{[e]:t});(r=this.mi)==null||r.register({[$d]:Object.keys(R1(l)),[na]:l}),this.ho()}getEarlyAccessFeatures(e,t,i){t===void 0&&(t=!1);var r=this.Xs(Hl),o=i?"&"+i.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 f,l;if(c.json){var d=c.json.earlyAccessFeatures;return(f=this.mi)==null||f.unregister(Hl),(l=this.mi)==null||l.register({[Hl]:d}),e(d)}}})}do(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((i=>t[i])),flagVariants:Object.keys(t).filter((i=>t[i])).reduce(((i,r)=>(i[r]=t[r],i)),{})}}ho(e){var t=this.do(),i=t.flags,r=t.flagVariants;this.featureFlagEventHandlers.forEach((o=>{try{o(i,r,{errorsLoading:e})}catch(c){Ts.error("Error while running feature flags callback",c)}}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this.Xs(ea)||{},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 f in o)({}).hasOwnProperty.call(o,f)&&(f in i||(c[f]=o[f]));this._instance.register({[ea]:Re({},i,c,r)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=Re({},this.Xs(ea)||{});e.forEach((r=>{delete i[r]})),this._instance.register({[ea]:i}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this._instance.unregister(ea),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this.Xs(ta)||{};Object.keys(i).length!==0&&Object.keys(i).forEach((r=>{i[r]=Re({},i[r],e[r]),delete e[r]})),this._instance.register({[ta]:Re({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Xs(ta)||{};this._instance.register({[ta]:Re({},t,{[e]:{}})})}else this._instance.unregister(ta)}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}}},JN={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===Tl||this.vo===Ru?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=w1,this.fo=void 0,this._instance=e,!this._instance.sessionManager)throw $n.error("started without valid sessionManager"),new Error(jv+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===qn)throw new Error(jv+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get po(){var e,t=!((e=this._instance.get_property(aa))==null||!e.enabled),i=!this.Te.disable_session_recording,r=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return _e&&t&&i&&!r}startIfEnabledOrStop(e){var t;if(!this.po||(t=this.co)==null||!t.isStarted){var i=!Me(Object.assign)&&!Me(Array.from);this.po&&i?(this.mo(e),$n.info("starting")):(this.vo=w1,this.stopRecording())}}mo(e){var t,i,r;this.po&&(this.vo!==Tl&&this.vo!==Ru&&(this.vo=x1),Ge!=null&&(t=Ge.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(i=Ge.__PosthogExtensions__)!=null&&i.initSessionRecording?this.yo(e):(r=Ge.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.bo,(o=>{if(o)return $n.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(rg),(t=this.mi)==null||t.unregister(Fx)}xo(e,t){if(lt(e))return null;var i,r=Gs(e)?e:parseFloat(e);return typeof(i=r)!="number"||!Number.isFinite(i)||0>i||i>1?($n.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}ko(e){if(this.mi){var t,i,r=this.mi,o=()=>{var c,f=e.sessionRecording===!1?void 0:e.sessionRecording,l=this.xo((c=this.Te.session_recording)==null?void 0:c.sampleRate,"session_recording.sampleRate"),d=this.xo(f==null?void 0:f.sampleRate,"remote config sampleRate"),m=l??d;lt(m)&&this.wo();var y=f==null?void 0:f.minimumDurationMilliseconds;r.register({[aa]:Re({cache_timestamp:Date.now(),enabled:!!f},f,{networkPayloadCapture:Re({capturePerformance:e.capturePerformance},f==null?void 0:f.networkPayloadCapture),canvasRecording:{enabled:f==null?void 0:f.recordCanvas,fps:f==null?void 0:f.canvasFps,quality:f==null?void 0:f.canvasQuality},sampleRate:m,minimumDurationMilliseconds:Me(y)?null:y,endpoint:f==null?void 0:f.endpoint,triggerMatchType:f==null?void 0:f.triggerMatchType,masking:f==null?void 0:f.masking,urlTriggers:f==null?void 0:f.urlTriggers,version:f==null?void 0:f.version,triggerGroups:f==null?void 0:f.triggerGroups})})};o(),(t=this.fo)==null||t.call(this),this.fo=(i=this._instance.sessionManager)==null?void 0:i.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===Tl&&(this.vo=Ru,$n.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var i;t===void 0&&(t="log"),(i=this.co)!=null&&i.log?this.co.log(e,t):$n.warn("log called before recorder was ready")}get bo(){var e,t,i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(aa);return(i==null||(t=i.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}So(){var e,t,i=this._instance.get_property(aa);if(!i)return!1;try{t=typeof i=="object"?i:JSON.parse(i)}catch(o){return $n.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,i;if((t=Ge.__PosthogExtensions__)==null||!t.initSessionRecording)return $n.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Zx]:!0});if(this.co||(this.co=(i=Ge.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance),this.co._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.So())return this.vo===Ru||this.vo===Tl?void 0:(this.vo=Tl,$n.info("persisted remote config is stale, requesting fresh config before starting"),void new CC(this._instance).load());this.vo=x1,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({[Wx]:!0}),(e=this.co)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.co||(t=this.mi)==null||t.register({[Vx]:!0}),(e=this.co)==null||e.overrideSampling()}overrideTrigger(e){var t,i;this.co||(i=this.mi)==null||i.register({[e==="url"?Gx:Kx]:!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 i;return!((i=this.co)==null||!i.tryAddCustomEvent(e,t))}}},ZN={autocapture:class{constructor(e){this.Co=!1,this.Mo=null,this.Io=!1,this.To=!1,this.instance=e,this.rageclicks=new y1(e.config.rageclick),this.Eo=null}initialize(){this.startIfEnabled()}get Te(){var e,t,i=ns(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=(e=i.url_allowlist)==null?void 0:e.map((r=>new RegExp(r))),i.url_ignorelist=(t=i.url_ignorelist)==null?void 0:t.map((r=>new RegExp(r))),i}Ro(){if(this.isBrowserSupported()){if(_e&&Ie){var e=i=>{i=i||(_e==null?void 0:_e.event);try{this.Po(i)}catch(r){pm.error("Failed to capture event",r)}};if(us(Ie,"submit",e,{capture:!0}),us(Ie,"change",e,{capture:!0}),us(Ie,"click",e,{capture:!0}),this.Te.capture_copied_text){var t=i=>{i=i||(_e==null?void 0:_e.event);try{this.Po(i,fm)}catch(r){pm.error("Failed to capture copy/cut event",r)}};us(Ie,"copy",t,{capture:!0}),us(Ie,"cut",t,{capture:!0})}}}else pm.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 i=t.autocapture_opt_out;Qi(i)&&(this.instance.persistence&&this.instance.persistence.register({[tv]:i}),this.Mo=i),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this.Eo=e}getElementSelectors(e){var t,i=[];return(t=this.Eo)==null||t.forEach((r=>{var o=Ie==null?void 0:Ie.querySelectorAll(r);o==null||o.forEach((c=>{e===c&&i.push(r)}))})),i}get isEnabled(){var e,t,i=(e=this.instance.persistence)==null?void 0:e.props[tv],r=this.Mo,o=this.instance.Ur()&&!this.Io;if(oi(r)&&!Qi(i)&&!o)return!1;var c=(t=this.Mo)!==null&&t!==void 0?t:!!i;return!!this.instance.config.autocapture&&!c}Po(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var i,r=tm(e);nC(r)&&(r=r.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Yb(r,this.instance.config.rageclick)&&this.Po(e,"$rageclick");var o=t===fm;if(r&&(function(v,S,w,R,x,g){var b;if(!_e||ug(v)||w!=null&&w.url_allowlist&&!Wb(w.url_allowlist,g)||w!=null&&w.url_ignorelist&&Wb(w.url_ignorelist,g))return!1;if(w!=null&&w.dom_event_allowlist){var p=w.dom_event_allowlist;if(p&&!p.some((j=>S.type===j)))return!1}var _=uC(v,R),k=_.parentIsUsefulElement,A=_.targetElementList;if(!(function(j,M){var O=M==null?void 0:M.element_allowlist;if(Me(O))return!0;var B,q=function(J){if(O.some((ee=>J.tagName.toLowerCase()===ee)))return{v:!0}};for(var V of j)if(B=q(V))return B.v;return!1})(A,w)||!yv(A,w==null?void 0:w.css_selector_allowlist)||yv(A,(b=w==null?void 0:w.css_selector_ignorelist)!==null&&b!==void 0?b:X3))return!1;try{var C=_e.getComputedStyle(v);if(C&&C.getPropertyValue("cursor")==="pointer"&&S.type==="click")return!0}catch{}var N=v.tagName.toLowerCase();switch(N){case"html":return!1;case"form":return(x||["submit"]).indexOf(S.type)>=0;case"input":case"select":case"textarea":return(x||["change","click"]).indexOf(S.type)>=0;default:return k?(x||["click"]).indexOf(S.type)>=0:(x||["click"]).indexOf(S.type)>=0&&(cg.indexOf(N)>-1||v.getAttribute("contenteditable")==="true")}})(r,e,this.Te,o,o?["copy","cut"]:void 0,this.instance)){var c=UN(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}),f=c.props;if(c.explicitNoCapture)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(f.$element_selectors=l),t===fm){var d,m=oC(_e==null||(d=_e.getSelection())==null?void 0:d.toString()),y=e.type||"clipboard";if(!m)return!1;f.$selected_content=m,f.$copy_type=y}return this.instance.capture(t,f),!0}}}isBrowserSupported(){return Ri(Ie==null?void 0:Ie.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&&(De.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Fo&&this.Fo(),this.Fo=void 0,De.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 i=this;(function(r,o,c){try{if(!(o in r))return b1;var f={next:r[o]},l=c((function(){for(var d=arguments.length,m=new Array(d),y=0;d>y;y++)m[y]=arguments[y];return f.next.apply(this,m)}));return Ri(l)&&(l.prototype=l.prototype||{},Object.defineProperties(l,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:f}})),r[o]=l,()=>{if(r[o]!==l)for(var d=r[o];Ri(d)&&d.__posthog_layer__;){var m=d.__posthog_layer__;if(m.next===l)return void(m.next=f.next);d=m.next}else r[o]=f.next}}catch{return b1}})(_e.history,e,(r=>function(o,c,f){r.call(this,o,c,f),i.Lo(e)}))}}Lo(e){try{var t,i=_e==null||(t=_e.location)==null?void 0:t.pathname;if(!i)return;i!==this.Oo&&this.isEnabled&&this._instance.capture(no,{navigation_type:e}),this.Oo=i}catch(r){De.error("Error capturing "+e+" pageview",r)}}$o(){if(!this.Fo){var e=()=>{this.Lo("popstate")};us(_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[sv]),this.rageclicks=new y1(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return ns(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(e=this.Te.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return lt(this.Te.capture_heatmaps)?lt(this.Te.enable_heatmaps)?this.Do:this.Te.enable_heatmaps:this.Te.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Co)return;FN.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 i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[sv]:i}),this.Do=i,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}Bo(e){vm(e.originalEvent)&&this.pe(e.originalEvent,"deadclick")}xe(){this.No&&clearInterval(this.No),this.No=(Ie==null?void 0:Ie.visibilityState)==="visible"?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}qo(){_e&&Ie&&(this.Ho=this.oi.bind(this),us(_e,ah,this.Ho),this.Uo=e=>this.pe(e||(_e==null?void 0:_e.event)),us(Ie,"click",this.Uo,{capture:!0}),this.zo=e=>this.Vo(e||(_e==null?void 0:_e.event)),us(Ie,"mousemove",this.zo,{capture:!0}),this.Wo=new s1(this.instance,iN,this.Bo.bind(this)),this.Wo.startIfEnabledOrStop(),this.Zo=this.xe.bind(this),us(Ie,rh,this.Zo),this.Co=!0)}jo(){var e;_e&&Ie&&(this.Ho&&_e.removeEventListener(ah,this.Ho),this.Uo&&Ie.removeEventListener("click",this.Uo,{capture:!0}),this.zo&&Ie.removeEventListener("mousemove",this.zo,{capture:!0}),this.Zo&&Ie.removeEventListener(rh,this.Zo),clearTimeout(this.Go),(e=this.Wo)==null||e.stop(),this.Co=!1)}Qo(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),o=this.instance.scrollManager.scrollElement(),c=(function(f,l,d){for(var m=f;m&&Cr(m)&&!Ti(m,"body");){if(m===d)return!1;var y=void 0;try{var v,S,w;y=(v=(S=(w=m.ownerDocument)==null?void 0:w.defaultView)!==null&&S!==void 0?S:_e)==null?void 0:v.getComputedStyle(m).position}catch{return!1}if(st(l,y))return!0;m=lC(m)}return!1})(tm(e),["fixed","sticky"],o);return{x:e.clientX+(c?0:r),y:e.clientY+(c?0:i),target_fixed:c,type:t}}pe(e,t){var i;if(t===void 0&&(t="click"),!Vb(e.target)&&vm(e)){var r=this.Qo(e,t);(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&Yb(tm(e),this.instance.config.rageclick)&&this.Wt(Re({},r,{type:"rageclick"})),this.Wt(r)}}Vo(e){!Vb(e.target)&&vm(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?xr(_e.location.href):_e.location.href,i=this.Te.custom_personal_data_properties,r=this.Te.mask_personal_data_properties?[...bo,...i||[]]:[],o=sc(t,r,ic);this.R=this.R||{},this.R[o]||(this.R[o]=[]),this.R[o].push(e)}}oi(){this.R&&!Sr(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:s1,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(((i,r)=>Re({},i,{["$web_vitals_"+r.name+"_event"]:Re({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Yo=i=>{var r;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Xo();if(!Me(o))if(lt(i==null?void 0:i.name)||lt(i==null?void 0:i.value))Gr.error("Invalid metric received",i);else if(!this.ta||this.ta>i.value){this.R.url!==o&&(this.Jo(),this.Ko=setTimeout(this.Jo,this.flushToCaptureTimeoutMs)),Me(this.R.url)&&(this.R.url=o),this.R.firstMetricTimestamp=Me(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,i.attribution&&i.attribution.interactionTargetElement&&(i.attribution.interactionTargetElement=void 0);var c=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0),f=Re({},i,{$current_url:o,timestamp:Date.now()});Me(c)||(f.$session_id=c.sessionId,f.$window_id=c.windowId),this.R.metrics.push(f),this.R.metrics.length===this.allowedMetrics.length&&this.Jo()}else Gr.error("Ignoring metric with value >= "+this.ta,i)},this.ea=()=>{if(!this.Co){var i,r,o,c,f=Ge.__PosthogExtensions__;if(!Me(f)&&!Me(f.postHogWebVitalsCallbacks)){var l=f.postHogWebVitalsCallbacks;i=l.onLCP,r=l.onCLS,o=l.onFCP,c=l.onINP}i&&r&&o&&c?(this.allowedMetrics.indexOf("LCP")>-1&&i(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):Gr.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Do=!((t=this._instance.persistence)==null||!t.props[av]),this.startIfEnabled()}get ra(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=ns(this.ra)?(e=this.ra)==null?void 0:e.web_vitals_allowed_metrics:void 0;return lt(i)?((t=this._instance.persistence)==null?void 0:t.props[ov])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(ns(this.ra)?this.ra.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=ns(this.ra)?this.ra.web_vitals_attribution:void 0;return e!=null&&e}get ta(){var e=ns(this.ra)&&Gs(this.ra.__web_vitals_max_value)?this.ra.__web_vitals_max_value:S1;return e>0&&6e4>=e?S1:e}get isEnabled(){var e=ws==null?void 0:ws.protocol;if(e!=="http:"&&e!=="https:")return Gr.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=ns(this.ra)?this.ra.web_vitals:Qi(this.ra)?this.ra:void 0;return Qi(t)?t:this.Do}startIfEnabled(){this.isEnabled&&!this.Co&&(Gr.info("enabled, starting..."),this.tr(this.ea))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var i=ns(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=ns(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[av]:i}),this._instance.persistence.register({[ov]:r})),this.Do=i,this.startIfEnabled()}}}tr(e){var t,i;(t=Ge.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(i=Ge.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(r=>{r?Gr.error("failed to load script",r):e()}))}Xo(){var e=_e?this._instance.config.disable_capture_url_hashes?xr(_e.location.href):_e.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...bo,...t||[]]:[];return sc(e,i,ic)}Gr.error("Could not determine current URL")}}},QN={exceptionObserver:class{constructor(e){var t;this.ea=()=>{var i;if(_e&&this.isEnabled&&(i=Ge.__PosthogExtensions__)!=null&&i.errorWrappingFunctions){var r=Ge.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=Ge.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,c=Ge.__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(f){Rl.error("failed to start",f),this.oa()}}},this._instance=e,this.aa=!((t=this._instance.persistence)==null||!t.props[iv]),this.la=new ZT(Re({},(function(i){var r,o,c,f;return i===void 0&&(i={}),{refillRate:(r=(o=i.exceptionRateLimiterRefillRate)!==null&&o!==void 0?o:i.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(c=(f=i.exceptionRateLimiterBucketSize)!==null&&f!==void 0?f:i.__exceptionRateLimiterBucketSize)!==null&&c!==void 0?c:10}})(this._instance.config.error_tracking),{refillInterval:1e4,it:Rl})),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 ns(e)?t=Re({},t,e):(Me(e)?this.aa:e)&&(t=Re({},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?(Rl.info("enabled"),this.oa(),this.tr(this.ea)):this.oa()}tr(e){var t,i;(t=Ge.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(i=Ge.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return Rl.error("failed to load script",r);e()}))}oa(){var e,t,i;(e=this.ia)==null||e.call(this),this.ia=void 0,(t=this.na)==null||t.call(this),this.na=void 0,(i=this.sa)==null||i.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({[iv]:this.aa}),this.Te=this.ua(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ua()}captureException(e){var t,i,r,o=(t=e==null||(i=e.$exception_list)==null||(i=i[0])==null?void 0:i.type)!==null&&t!==void 0?t:"Exception";this.la.consumeRateLimit(o)?Rl.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,i;this.ha=[],this.da=new m3([new x3,new M3,new E3,new C3,new T3,new R3,new A3,new N3],(function(r){for(var o=arguments.length,c=new Array(o>1?o-1:0),f=1;o>f;f++)c[f-1]=arguments[f];return function(l,d){d===void 0&&(d=0);for(var m=[],y=l.split(`
454
+ `),v=d;y.length>v;v++){var S=y[v];if(1024>=S.length){var w=zb.test(S)?S.replace(zb,"$1"):S;if(!w.match(/\S*Error: /)){for(var R of c){var x=R(w,r);if(x){m.push(x);break}}if(m.length>=50)break}}}return(function(g){if(!g.length)return[];var b=Array.from(g);return b.reverse(),b.slice(0,50).map((p=>{return Re({},p,{filename:p.filename||(_=b,_[_.length-1]||{}).filename,function:p.function||_o});var _}))})(m)}})("web:javascript",y3,w3)),this._instance=e,this.ha=(t=(i=this._instance.persistence)==null?void 0:i.get_property(nv))!==null&&t!==void 0?t:[],this.ca=eh(this.va()),this.fa=new O3(this.ca)}onConfigChange(){this.ca=eh(this.va()),this.fa.setConfig(this.ca)}onRemoteConfig(e){var t,i,r;if(e.ok){var o=e.config;if("errorTracking"in o){var c=(t=(i=o.errorTracking)==null?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],f=(r=o.errorTracking)==null?void 0:r.captureExtensionExceptions;this.ha=c,this._instance.persistence&&this._instance.persistence.register({[nv]:this.ha,[rv]:f})}}}get pa(){var e,t=!!this._instance.get_property(rv),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??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(!Kt(e)||e.trim().length===0)return void un.warn("Ignoring exception step because message must be a non-empty string");var i=(function(c){if(!c)return{sanitizedProperties:{},droppedKeys:[]};var f=[];return{sanitizedProperties:Object.keys(c).reduce(((l,d)=>D3.has(d)?(f.push(d),l):(l[d]=c[d],l)),{}),droppedKeys:f}})(this.ga(t)),r=i.sanitizedProperties,o=i.droppedKeys;o.length>0&&un.warn("Ignoring reserved exception step fields",{droppedKeys:o}),this.fa.add(Re({[Zd]:e,[Qd]:new Date().toISOString()},r))}catch(c){un.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 un.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 un.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 un.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.ca.enabled&&lt(e.$exception_steps)?this.xa(e):e,r=typeof(c=globalThis._posthogReleaseId)=="string"&&c.length>0?c:void 0;r&&(i.$release_id=r);try{var o=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Pn:!0});return o&&this.fa.clear(),o}catch(f){return un.error("Failed to capture exception event. Dropping this exception.",f),void this.fa.clear()}}catch(f){return void un.error("Failed to process exception event. Ignoring this exception.",f)}var c}xa(e){try{var t=this.fa.getAttachable();return t.length===0?e:Re({},e,{$exception_steps:t})}catch(i){return un.error("Failed to read buffered exception steps. Capturing exception without steps.",i),e}}ba(e){this.ca.enabled&&this.fa.add({[Zd]:e,[Qd]:new Date().toISOString()})}ga(e){return ns(e)?Re({},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(((i,r)=>{var o=r.type,c=r.value;return Kt(o)&&o.length>0&&i.$exception_types.push(o),Kt(c)&&c.length>0&&i.$exception_values.push(c),i}),{$exception_types:[],$exception_values:[]});return this.ha.some((i=>{var r=i.values.map((o=>{var c=IC[o.operator],f=t[o.key];if(!c||!f)return!1;var l=rt(o.value)?o.value:[o.value];return l.length>0&&c(l,f)}));return i.type==="OR"?r.some(Boolean):r.every(Boolean)}))}catch(i){return un.warn("Failed to evaluate suppression rules. Capturing the exception.",i),!1}}_a(e){return e.flatMap((t=>{var i,r;return(i=(r=t.stacktrace)==null?void 0:r.frames)!==null&&i!==void 0?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}wa(e){if(e.length>0){var t,i,r,o,c=(t=(i=e[0].stacktrace)==null?void 0:i.frames)!==null&&t!==void 0?t:[],f=c[c.length-1];return(r=f==null||(o=f.filename)==null?void 0:o.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}ma(e){return!lt(e)&&rt(e)}}},e4=Re({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 i,r;if(this.mi&&this.mi.register({[ng]:!!t.productTours}),!_m(this._instance))return!this.ka&&lt((i=this.mi)==null?void 0:i.props[zl])||gm.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&&_m(this._instance)&&this.tr((()=>this.Ca()))}tr(e){var t,i;(t=Ge.__PosthogExtensions__)!=null&&t.generateProductTours?e():(i=Ge.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"product-tours",(r=>{r?gm.error("Could not load product tours script",r):e()}))}Ca(){var e;!this.ka&&(e=Ge.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.ka=Ge.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!rt(this.Sa)||t){var i=this.mi;if(i){var r=i.props[zl];if(rt(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(_m(this._instance)){var c=o.statusCode;if(c!==200||!o.json){var f="Product Tours API could not be loaded, status: "+c;return gm.error(f),void e([],{isLoaded:!1,error:f})}var l=rt(o.json.product_tours)?o.json.product_tours:[];this.Sa=l,i&&i.register({[zl]:l}),e(l,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Sa,{isLoaded:!0})}getActiveProductTours(e){lt(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(zl)}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)}}},Ah),t4={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 i=this.globalsForEvent(t);this.Ia.push(i),this.Ia.length>1e3&&(this.Ia=this.Ia.slice(10))}}get siteAppLoaders(){var e;return(e=Ge._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,i,r,o,c,f,l;if(!e)throw new Error("Event payload is required");var d={},m=this._instance.get_property("$groups")||[],y=this._instance.get_property("$stored_group_properties")||{};for(var v of Object.entries(y)){var S=v[0];d[S]={id:m[S],type:S,properties:v[1]}}var w=e.$set_once,R=e.$set;return{event:Re({},ux(e,VN),{properties:Re({},e.properties,R?{$set:Re({},(t=(i=e.properties)==null?void 0:i.$set)!==null&&t!==void 0?t:{},R)}:{},w?{$set_once:Re({},(r=(o=e.properties)==null?void 0:o.$set_once)!==null&&r!==void 0?r:{},w)}:{}),elements_chain:(c=(f=e.properties)==null?void 0:f.$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:d}}Ra(e){var t,i=(t=e.tagName)==null?void 0:t.toLowerCase();return i==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(cn.error("prepare_external_dependency_stylesheet returned null"),null):i==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(cn.error("prepare_external_dependency_script returned null"),null):e}Pa(){var e,t,i,r,o,c,f,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var d=Ie==null?void 0:Ie.defaultView,m=d==null||(e=d.Node)==null?void 0:e.prototype;if(!d||!m)return()=>{};if(this.Ma++,this.Oa)return this.Fa();var y=[],v=this,S=new WeakSet,w=(g,b,p)=>{if(g!=null&&g[b]){var _=g[b];g[b]=p(_),y.push((()=>{g[b]=_}))}},R=g=>{if(S.has(g))return g;var b=v.Ra(g);return b&&S.add(b),b},x=g=>g.map((b=>typeof b=="string"?b:R(b))).filter((b=>!oi(b)));return w(m,"appendChild",(g=>function(b){var p=R(b);return p?g.call(this,p):b})),w(m,"insertBefore",(g=>function(b,p){var _=R(b);return _?g.call(this,_,p):b})),w(m,"replaceChild",(g=>function(b,p){var _=R(b);return _?g.call(this,_,p):p})),[(t=d.Element)==null?void 0:t.prototype,(i=d.Document)==null?void 0:i.prototype,(r=d.DocumentFragment)==null?void 0:r.prototype].forEach((g=>{w(g,"append",(b=>function(){for(var p=arguments.length,_=new Array(p),k=0;p>k;k++)_[k]=arguments[k];return b.apply(this,x(_))})),w(g,"prepend",(b=>function(){for(var p=arguments.length,_=new Array(p),k=0;p>k;k++)_[k]=arguments[k];return b.apply(this,x(_))}))})),[(o=d.Element)==null?void 0:o.prototype,(c=d.CharacterData)==null?void 0:c.prototype,(f=d.DocumentType)==null?void 0:f.prototype].forEach((g=>{w(g,"before",(b=>function(){for(var p=arguments.length,_=new Array(p),k=0;p>k;k++)_[k]=arguments[k];return b.apply(this,x(_))})),w(g,"after",(b=>function(){for(var p=arguments.length,_=new Array(p),k=0;p>k;k++)_[k]=arguments[k];return b.apply(this,x(_))})),w(g,"replaceWith",(b=>function(){for(var p=arguments.length,_=new Array(p),k=0;p>k;k++)_[k]=arguments[k];var A=x(_);return _.length&&!A.length?void 0:b.apply(this,A)}))})),w((l=d.Element)==null?void 0:l.prototype,"insertAdjacentElement",(g=>function(b,p){var _=R(p);return _?g.call(this,b,_):null})),this.Oa=()=>{y.forEach((g=>g())),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 i=this.Pa();try{var r=e(i);return t&&i(),r}catch(o){throw i(),o}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var f;!t.errored&&this.Ia.length&&(cn.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))&&((f=this.Ea)==null||f.call(this))},r=!1,o=f=>{t.errored=!f,t.loaded=!0,cn.info("Site app with id "+e.id+" "+(f?"loaded":"errored")),r&&i()};try{var c=this.Aa((f=>e.init({posthog:this._instance,callback(l){f(),o(l)}})),!1).processEvent;c&&(t.processEvent=c),r=!0}catch(f){cn.error(C1+e.id,f),o(!1)}if(r&&t.loaded)try{i()}catch(f){cn.error("Error while processing buffered events PostHog app with config id "+e.id,f),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 i of e)this.setupSiteApp(i)}La(e){var t=this;if(Object.keys(this.apps).length!==0){var i=this.globalsForEvent(e),r=function(c){try{t.Aa((()=>c.processEvent==null?void 0:c.processEvent(i)))}catch(f){cn.error("Error while processing event "+e.event+" for site app "+c.id,f)}};for(var o of Object.values(this.apps))r(o)}}onRemoteConfig(e){var t,i,r,o=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.$a(),void this._instance.on("eventCaptured",(d=>this.La(d)))):void cn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.Ea)==null||i.call(this),e.ok){var c=e.config;if((r=c.siteApps)!=null&&r.length)if(this.isEnabled){var f=function(){var d,m=l.id,y=l.url;Ge["__$$ph_site_app_"+m]=o._instance,(d=Ge.__PosthogExtensions__)==null||d.loadSiteApp==null||d.loadSiteApp(o._instance,y,(v=>{if(v)return cn.error(C1+m,v)}))};for(var l of c.siteApps)f()}else cn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},s4={tracingHeaders:class{constructor(e){this.Da=void 0,this.Na=void 0,this.qa=void 0,this.ea=()=>{var t,i,r=this.ja();r?(Me(this.Da)&&(this.Da=(t=Ge.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Me(this.Na)&&(this.Na=(i=Ge.__PosthogExtensions__)==null||(i=i.tracingHeadersPatchFns)==null?void 0:i._patchFetch(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.oa()},this._instance=e}initialize(){this.startIfEnabledOrStop()}tr(e){var t,i;(t=Ge.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(i=Ge.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return qN.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 rt(e)?(rt(this.qa)?this.qa.splice(0,this.qa.length,...e):this.qa=[...e],e.length>0?this.qa:void 0):(rt(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()}}},i4=Re({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 qt.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(lt(t))return qt.warn("Flags not loaded yet. Not loading surveys.");var i=rt(t);this.Ha=i?t.length>0:t,qt.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=[],i=0;i<localStorage.length;i++){var r=localStorage.key(i);(r!=null&&r.startsWith(HC)||r!=null&&r.startsWith("inProgressSurvey_"))&&t.push(r)}t.forEach((o=>localStorage.removeItem(o)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.Ua)qt.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)qt.info(E1);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())qt.info("Not loading surveys in cookieless mode without consent.");else{var e=Ge==null?void 0:Ge.__PosthogExtensions__;if(e){if(!Me(this.Ha)||this.Te.advanced_enable_surveys){var t=this.Ha||this.Te.advanced_enable_surveys;this.Ua=!0;try{var i=e.generateSurveys;if(i)return void this.Za(i,t);var r=e.loadExternalDependency;if(!r)return void this.Ga(ag);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 qt.error("PostHog Extensions not found.")}}Za(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new KN(this._instance),qt.info("Surveys loaded successfully"),this.Qa({isLoaded:!0})}Ga(e,t){qt.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 qt.info(E1),e([]);var i,r=this._instance.get_property(uv);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=>{i=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 f=o.statusCode;if(f!==200||!o.json){var l="Surveys API could not be loaded, status: "+f;qt.error(l),this.Wa=Date.now();var d={isLoaded:!1,error:l};return e([],d),void(i==null||i({surveys:[],context:d}))}this.Wa=null;var m,y=o.json.surveys||[],v=y.filter((w=>(function(R){return!(!R.start_date||R.end_date)})(w)&&(BC(w)||(function(R){var x;return!((x=R.conditions)==null||(x=x.actions)==null||(x=x.values)==null||!x.length)})(w))));v.length>0&&((m=this._surveyEventReceiver)==null||m.register(v)),(c=this._instance.persistence)==null||c.register({[uv]:y,[sh]:Date.now()});var S={isLoaded:!0};e(y,S),i==null||i({surveys:y,context:S})}}))}Ja(){return this.Ka()&&!this.Va&&!this.Ya()}Ka(){var e=this._instance.get_property(sh);return Gs(e)&&Date.now()-e>3e5}Ya(){return Gs(this.Wa)&&3e5>Date.now()-this.Wa}markSurveyAsSeen(e,t){var i,r={id:e,current_iteration:(i=t==null?void 0:t.iteration)!==null&&i!==void 0?i:null};zC(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(i){qt.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!lt(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);qt.warn("init was not called")}Xa(e){var t=null;return this.getSurveys((i=>{var r;t=(r=i.find((o=>o.id===e)))!==null&&r!==void 0?r:null})),t}tl(e){if(lt(this._surveyManager))return{eligible:!1,reason:Tu};var t=typeof e=="string"?this.Xa(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}el(e){if(lt(this._surveyManager))return{eligible:!1,reason:Tu};var t=typeof e=="string"?this.Xa(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(lt(this._surveyManager))return qt.warn("init was not called"),{visible:!1,disabledReason:Tu};var t=this.el(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return lt(this._surveyManager)?(qt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Tu})):new Promise((i=>{this.getSurveys((r=>{var o,c=(o=r.find((l=>l.id===e)))!==null&&o!==void 0?o:null;if(c){var f=this.el(c);i({visible:f.eligible,disabledReason:f.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,i){var r;if(lt(this._surveyManager))qt.warn("init was not called");else{var o=typeof e=="string"?this.Xa(e):e;if(o!=null&&o.id)if(TN.includes(o.type)){var c=Ie==null?void 0:Ie.querySelector(t);if(c)return(r=o.appearance)!=null&&r.surveyPopupDelaySeconds?(qt.info("Rendering survey "+o.id+" with delay of "+o.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var f,l;qt.info("Rendering survey "+o.id+" with delay of "+((f=o.appearance)==null?void 0:f.surveyPopupDelaySeconds)+" seconds"),(l=this._surveyManager)==null||l.renderSurvey(o,c,i),qt.info("Survey "+o.id+" rendered")}),1e3*o.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(o,c,i);qt.warn("Survey element not found")}else qt.warn("Surveys of type "+o.type+" cannot be rendered in the app");else qt.warn("Survey not found")}}displaySurvey(e,t){var i;if(lt(this._surveyManager))qt.warn("init was not called");else{var r=this.Xa(e);if(r){var o=r;if((i=r.appearance)!=null&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(o=Re({},r,{appearance:Re({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Sv.Popover&&t.initialResponses&&qt.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 qt.warn("Survey is not eligible to be displayed: ",c.reason)}t.displayType!==Sv.Inline?this._surveyManager.handlePopoverSurvey(o,t):this.renderSurvey(o,t.selector,t.properties)}else qt.warn("Survey not found")}}cancelPendingSurvey(e){lt(this._surveyManager)?qt.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}}},Ah),n4={toolbar:class{constructor(e){this.instance=e}rl(e){Ge.ph_toolbar_state=e}il(){var e;return(e=Ge.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,i){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),Qx(this.instance.config)||!_e||!Ie)return!1;e=e??_e.location,i=i??_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=YN||uh(e.hash,"__posthog")||uh(e.hash,"state"),c=o?qb((()=>JSON.parse(atob(decodeURIComponent(o)))))||qb((()=>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:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(k1)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}nl(e){var t=Ge.ph_load_toolbar||Ge.ph_load_editor;!lt(t)&&Ri(t)?t(e,this.instance):A1.warn("No toolbar load function found")}loadToolbar(e){var t=!(Ie==null||!Ie.getElementById(iC));if(!_e||t)return!1;var i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=Re({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(_e.localStorage.setItem(k1,JSON.stringify(Re({},r,{source:void 0}))),this.il()===2)this.nl(r);else if(this.il()===0){var o;this.rl(1),(o=Ge.__PosthogExtensions__)==null||o.loadExternalDependency==null||o.loadExternalDependency(this.instance,"toolbar",(c=>{if(c)return A1.error("[Toolbar] Failed to load",c),void this.rl(0);this.rl(2),this.nl(r)})),us(_e,"turbolinks:load",(()=>{this.rl(0),this.loadToolbar(r)}))}return!0}sl(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}},r4=Re({experiments:Js},Ah),a4={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;lt(t)||(Qi(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||Qx(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Ge==null?void 0:Ge.__PosthogExtensions__;if(e&&!Me(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 i=e.loadExternalDependency;if(!i)return void this.hl(ag);i(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 qi.error("Conversations enabled but missing token in remote config.")}}ul(e){if(this.ll)try{this._conversationsManager=e(this.ll,this._instance),qi.info("Conversations loaded successfully")}catch(t){this.hl("Error completing conversations initialization",t)}else qi.error("Cannot complete initialization: remote config is null")}hl(e,t){qi.error(e,t),this._conversationsManager=null,this.al=!1}show(){this._conversationsManager?this._conversationsManager.show():qi.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.ol===!0&&!oi(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,i){var r=this;return rs((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,i):(qi.warn(Yr),null)}))()}getMessages(e,t){var i=this;return rs((function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(qi.warn(Yr),null)}))()}markAsRead(e){var t=this;return rs((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(qi.warn(Yr),null)}))()}getTickets(e){var t=this;return rs((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(qi.warn(Yr),null)}))()}requestRestoreLink(e){var t=this;return rs((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(qi.warn(Yr),null)}))()}restoreFromToken(e){var t=this;return rs((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(qi.warn(Yr),null)}))()}restoreFromUrlToken(){var e=this;return rs((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(qi.warn(Yr),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()}}},o4={logs:class{constructor(e){var t;this.dl=!1,this.cl=!1,this.it=os("[logs]"),this.Gr=[],this.vl=[],this.Js=0,this.fl=()=>{var i,r;this.Js=0,(i=this.pl)==null||i.onReconnect(),(r=this.gl)==null||r.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.dl=!0),_e&&us(_e,"online",this.fl)}ml(e,t,i,r){var o,c=(function(f,l){var d,m,y,v,S,w,R,x=(d=f==null?void 0:f.flushIntervalMs)!==null&&d!==void 0?d:3e3,g=(m=f==null?void 0:f.maxBufferSize)!==null&&m!==void 0?m:100,b=l!=null&&l.consoleCapture?void 0:(y=f==null?void 0:f.maxLogsPerInterval)!==null&&y!==void 0?y:1e3,p=Me(b)?Math.max(g,2048):Math.max(g,b),_=f==null?void 0:f.resourceAttributes;return{serviceName:(v=(S=_==null?void 0:_["service.name"])!==null&&S!==void 0?S:f==null?void 0:f.serviceName)!==null&&v!==void 0?v:l==null?void 0:l.serviceNameDefault,serviceVersion:(w=_==null?void 0:_["service.version"])!==null&&w!==void 0?w:f==null?void 0:f.serviceVersion,environment:(R=_==null?void 0:_["deployment.environment"])!==null&&R!==void 0?R:f==null?void 0:f.environment,resourceAttributes:_,beforeSend:f==null?void 0:f.beforeSend,flushIntervalMs:x,maxBufferSize:g,maxQueueSize:p,maxBatchRecordsPerPost:100,rateCapWindowMs:x,maxLogsPerInterval:b,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((o=this._instance)==null||(o=o.config)==null?void 0:o.logs,i);return[new h3(this.yl(e,t),c,this.it,(()=>this.bl()),(f=>f()),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 i;(i=this.pl)==null||i.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 i;(i=this.gl)==null||i.reset(),this.Sl=t;var r=this.ml((()=>this.vl),(o=>{this.vl=o}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},N1);this.gl=r[0],this.Cl=r[1]}return this.gl}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var i=(t=e.config.logs)==null?void 0:t.captureConsoleLogs;!lt(i)&&i&&(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=Ge==null?void 0:Ge.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(i=>{var r;i||(r=e.logs)==null||!r.initializeLogs?this.it.error("Could not load logs script",i):(e.logs.initializeLogs(this._instance),this.cl=!0)})):this.it.error(ag)}else this.it.error("PostHog Extensions not found.")}}yl(e,t){var i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:r=>r===zn.LogsQueue?e():void 0,setPersistedProperty(r,o){var c;r===zn.LogsQueue&&t((c=o)!==null&&c!==void 0?c:[])},$t:r=>this.$t(r),getLibraryId:()=>Bt.LIB_NAME,getLibraryVersion:()=>Bt.LIB_VERSION}}$t(e){return new Promise((t=>{if(mC(this.Js,3))t({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var i=!1,r=c=>{i||(i=!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 f=c.statusCode;if(this.El(f),f>=200&&300>f)r({kind:"ok"});else if(f===413)r({kind:"too-large"});else if(f!==0&&f!==429&&500>f)r({kind:"fatal",error:new Error("logs request failed with status "+f)});else{var l;r({kind:"retry-later",error:(l=c.error)!==null&&l!==void 0?l:new Error("logs request failed with status "+f)})}}})}}))}El(e){(e!==0||this._instance.__loaded)&&(this.Js=vC(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,Bt.LIB_NAME,(t=>{this.Gr=t})),this.vl.length>0&&this.Rl(e,this.vl,this.Cl,N1,(t=>{this.vl=t}))}Rl(e,t,i,r,o){if(t.length!==0){var c=t.map((l=>l.record));o([]);var f=Bx(c,Px(i,Bt.LIB_NAME,Bt.LIB_VERSION),r,Bt.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Tl(),data:f,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 i=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=i.windowId,o=i.sessionStartTimestamp,c=i.lastActivityTimestamp;t.sessionId=i.sessionId,t.windowId=r,lt(o)||(t.sessionStartTimestamp=o),lt(c)||(t.lastActivityTimestamp=c)}if(Ge!=null&&(e=Ge.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?xr(Ge.location.href):Ge.location.href),this._instance.featureFlags){var f=this._instance.featureFlags.getFlags();f&&f.length>0&&(t.activeFeatureFlags=f)}return t}}},l4={metrics:class{constructor(e){this.it=os("[metrics]"),this._instance=e}initialize(){}_l(){var e,t,i=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.pl&&this.wl===i||((t=this.pl)==null||t.reset(),this.wl=i,this.pl=new f3(this.yl(),(function(r){var o,c,f,l,d,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:(f=m==null?void 0:m["deployment.environment"])!==null&&f!==void 0?f: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:(d=r==null?void 0:r.maxSeriesPerFlush)!==null&&d!==void 0?d:1e3}})(i),this.it)),this.pl}count(e,t,i){t===void 0&&(t=1),this._l().count(e,t,i)}gauge(e,t,i){this._l().gauge(e,t,i)}histogram(e,t,i){this._l().histogram(e,t,i)}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((i=>this.it.error("PostHog metrics flush failed:",i)))}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:i=>t.Kt(i),getLibraryId:()=>Bt.LIB_NAME,getLibraryVersion:()=>Bt.LIB_VERSION}}Kt(e,t){return new Promise((i=>{var r=!1,o=f=>{r||(r=!0,clearTimeout(c),i(f))},c=setTimeout((()=>o({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(Re({method:"POST",url:this.Pl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(f){var l=f.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 d;o({kind:"retry-later",error:(d=f.error)!==null&&d!==void 0?d:new Error("metrics request failed with status "+l)})}}}))}))}Pl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},c4=Re({},Ah,JN,ZN,QN,e4,t4,i4,s4,n4,r4,a4,o4,l4);Vi.__defaultExtensionClasses=Re({},c4);var Ni=(function(){Bt.SDK_DIST_CHANNEL="npm";var e=Yl[ro]=new Vi;return(function(){function t(){t.done||(t.done=!0,qC=!1,Yt(Yl,(function(i){i._dom_loaded()})))}Ie!=null&&Ie.addEventListener?Ie.readyState==="complete"?t():us(Ie,"DOMContentLoaded",t,{capture:!1}):_e&&De.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();function u4(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 Os(e,t){try{Ni.capture(e,t)}catch{}}let Za=null;function d4(){var e,t;if(Za)return Za;try{Za=((t=(e=globalThis.crypto)==null?void 0:e.randomUUID)==null?void 0:t.call(e))??null}catch{Za=null}return Za??(Za=`boot-${Math.random().toString(36).slice(2)}${Math.random().toString(36).slice(2)}`),Za}function pg(e){try{const t={};for(const[i,r]of Object.entries(e))r!=null&&r!==""&&(t[i]=r);Ni.register(t)}catch{}}function h4(e){try{const t=u4(e);Ni.register({journey:t,view:f4(e)})}catch{}}function f4(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 p4=4e3;function m4(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.kind=="string"&&typeof t.label=="string"}function v4({sessionId:e,lastMessage:t,boundWorkflow:i,noSessionAgent:r=null,overviewActive:o,sessionExited:c,expanded:f,onToggleExpanded:l,macros:d,tasks:m,onRunMacro:y,onInjectPrompt:v,onDescribeWorkflow:S,surface:w,onOpenSteps:R,run:x,runTarget:g,runs:b,onSelectRun:p,preview:_,deployState:k,onDismissDeploy:A,onOpenCode:C,workflows:N,onOpenWorkflow:j,onCanvasState:M,onGraphChange:O}){const[B,q]=z.useState(!1),V=z.useRef(M);V.current=M;const J=z.useRef(O);J.current=O;const ee=z.useRef((i==null?void 0:i.path)??null);ee.current=(i==null?void 0:i.path)??null;const[W,Q]=z.useState(0),[ie,I]=z.useState(bh()),[P,D]=z.useState(!1),[H,U]=z.useState(!0),[L,G]=z.useState(!1),se=z.useRef(null),Y=z.useRef(null),F=z.useRef(0),le=z.useCallback(()=>{U(!1),G(!0),se.current&&clearTimeout(se.current),se.current=setTimeout(()=>G(!1),360)},[]),ae=()=>{const ve=F.current-Date.now();Y.current&&clearTimeout(Y.current),ve>0?Y.current=setTimeout(le,ve):le()};z.useEffect(()=>()=>{se.current&&clearTimeout(se.current),Y.current&&clearTimeout(Y.current)},[]),z.useEffect(()=>{if(!H)return;const ve=window.setTimeout(le,p4);return()=>window.clearTimeout(ve)},[H,le]);const[X,te]=z.useState(1),[ue,me]=z.useState({x:0,y:0}),[je,Oe]=z.useState(!1),Le=z.useRef(null),at=z.useRef(null),[Ee,qe]=z.useState(.25),We=ve=>Math.min(3,Math.max(Ee,Math.round(ve*100)/100)),[it,Ze]=z.useState(null),Je=z.useRef(!1),[wt,mt]=z.useState({zoom:1,x:0,y:0}),Qt=z.useCallback(()=>{const ve=Le.current;if(!it||!ve)return null;const $e=ve.getBoundingClientRect();if($e.width<80||$e.height<80)return null;const Be=$e.width-it.insetX*2,Fe=$e.height-it.insetTop-it.insetBottom;if(Be<=0||Fe<=0)return null;const Ke=Math.min(1,Be/it.width,Fe/it.height);return{zoom:Math.max(.1,Math.round(Ke*100)/100),x:0,y:0}},[it]),Mt=z.useCallback(()=>{let ve=12;const $e=()=>{const Be=Qt();if(Be){qe(Math.min(.25,Be.zoom)),Je.current=!1,te(Be.zoom),me({x:Be.x,y:Be.y}),mt(Be);return}if(it&&ve-- >0){requestAnimationFrame($e);return}qe(.25),Je.current=!1,te(1),me({x:0,y:0}),mt({zoom:1,x:0,y:0})};$e()},[Qt,it]);z.useEffect(()=>{!it||Je.current||Mt()},[it,Mt]),z.useEffect(()=>{const ve=Le.current;if(!ve||typeof ResizeObserver>"u")return;const $e=new ResizeObserver(()=>{Je.current||Mt()});return $e.observe(ve),()=>$e.disconnect()},[Mt]),z.useEffect(()=>{var Be,Fe,Ke;(Fe=(Be=at.current)==null?void 0:Be.contentWindow)==null||Fe.postMessage({type:"sapiom-canvas:view",zoom:X,x:ue.x,y:ue.y},"*");const ve=Lt.current,$e=at.current;if(ve&&$e){const es=$e.getBoundingClientRect();(Ke=$e.contentWindow)==null||Ke.postMessage({type:"sapiom-canvas:hover",x:ve.x-es.left,y:ve.y-es.top},"*")}},[X,ue]),z.useEffect(()=>{const ve=Le.current;if(!ve)return;const $e=Be=>{Be.preventDefault(),Je.current=!0,te(Fe=>We(Fe*(Be.deltaY<0?1.1:1/1.1)))};return ve.addEventListener("wheel",$e,{passive:!1}),()=>ve.removeEventListener("wheel",$e)});const At=ve=>{var Fe,Ke;const $e=at.current;if(!$e)return;const Be=$e.getBoundingClientRect();if(typeof ve.clientX=="number"&&typeof ve.clientY=="number"){const{clientX:es,clientY:Ye,...ts}=ve;(Fe=$e.contentWindow)==null||Fe.postMessage({...ts,x:es-Be.left,y:Ye-Be.top},"*");return}(Ke=$e.contentWindow)==null||Ke.postMessage(ve,"*")},[hs,Ft]=z.useState(!1),pt=z.useRef(!1),xs=z.useRef(0),Lt=z.useRef(null),Ns=ve=>{if(Lt.current={x:ve.clientX,y:ve.clientY},je)return;const{clientX:$e,clientY:Be}=ve;cancelAnimationFrame(xs.current),xs.current=requestAnimationFrame(()=>{At({type:"sapiom-canvas:hover",clientX:$e,clientY:Be})})},fs=()=>{cancelAnimationFrame(xs.current),Lt.current=null,Ft(!1),pt.current=!1,At({type:"sapiom-canvas:hover",x:-1,y:-1})},jt=ve=>{if(ve.button!==0)return;const $e=ve.currentTarget;try{$e.setPointerCapture(ve.pointerId)}catch{}Oe(!0),At({type:"sapiom-canvas:press",clientX:ve.clientX,clientY:ve.clientY,down:!0});let Be=!0;const Fe=()=>{Be&&(Be=!1,At({type:"sapiom-canvas:press",down:!1}))};let Ke=ve.clientX,es=ve.clientY;const Ye=ve.clientX,ts=ve.clientY,et=It=>{const Ys=It.clientX-Ke,nn=It.clientY-es;Ke=It.clientX,es=It.clientY,(Math.abs(It.clientX-Ye)>=4||Math.abs(It.clientY-ts)>=4)&&(Fe(),Je.current=!0),me(pn=>({x:pn.x+Ys,y:pn.y+nn}))},dt=It=>{Oe(!1),Fe(),$e.removeEventListener("pointermove",et),$e.removeEventListener("pointerup",dt),$e.removeEventListener("pointercancel",dt),Math.abs(It.clientX-Ye)<4&&Math.abs(It.clientY-ts)<4&&(At({type:"sapiom-canvas:pick",clientX:It.clientX,clientY:It.clientY}),pt.current||_s(null))};$e.addEventListener("pointermove",et),$e.addEventListener("pointerup",dt),$e.addEventListener("pointercancel",dt)},[ps,_s]=z.useState(null);z.useEffect(()=>{if(w==="steps"&&x&&f||!f&&ps==null)return;const ve=$e=>{$e.key==="Escape"&&(ps!=null?_s(null):l())};return window.addEventListener("keydown",ve),()=>window.removeEventListener("keydown",ve)},[f,ps,l,x,w]);const[Qs,ei]=z.useState(!0),[Ks,$s]=z.useState(!1),[gi,ds]=z.useState(null),[Ls,_i]=z.useState(null),[ys,Ae]=z.useState(null),[Pe,Qe]=z.useState(null);z.useEffect(()=>{const ve=$e=>{var Fe,Ke,es;const Be=$e.data;if(!(!Be||$e.source!==((Fe=at.current)==null?void 0:Fe.contentWindow))){if(Be.type==="sapiom-canvas:overview")ds({description:typeof Be.description=="string"?Be.description:"",stats:typeof Be.stats=="string"?Be.stats:"",notes:Array.isArray(Be.notes)?Be.notes.filter(Ye=>typeof Ye=="string"):[],badges:Array.isArray(Be.badges)?Be.badges.filter(Ye=>typeof Ye=="string"):[],legend:Array.isArray(Be.legend)?Be.legend.filter(m4):[]});else if(Be.type==="sapiom-canvas:graph"){const Ye=fA(Be.graph);Ae(Ye);const ts=ee.current;Ye&&ts&&((Ke=J.current)==null||Ke.call(J,ts,Ye)),(es=V.current)==null||es.call(V,!0)}else if(Be.type==="sapiom-canvas:node"){const Ye=Be.id;typeof Ye=="string"&&_s(Ye)}else if(Be.type==="sapiom:node-click"){const Ye=Be.stepName;typeof Ye=="string"&&Ae(ts=>{if(ts){const et=ts.nodes.find(dt=>dt.label===Ye)??ts.nodes.find(dt=>dt.id===Ye)??null;et&&_s(et.id)}return ts})}else if(Be.type==="sapiom-canvas:hit"){const Ye=typeof Be.id=="string";Ft(Ye),pt.current=Ye}else if(Be.type==="sapiom-canvas:size"){const Ye=Be;typeof Ye.width=="number"&&Ye.width>0&&typeof Ye.height=="number"&&Ye.height>0&&Ze({width:Ye.width,height:Ye.height,insetTop:typeof Ye.insetTop=="number"&&Ye.insetTop>=0?Ye.insetTop:0,insetBottom:typeof Ye.insetBottom=="number"&&Ye.insetBottom>=0?Ye.insetBottom:0,insetX:typeof Ye.insetX=="number"&&Ye.insetX>=0?Ye.insetX:0})}else if(Be.type==="sapiom-canvas:error"){const Ye=Be;_i({title:typeof Ye.title=="string"?Ye.title:"",reason:typeof Ye.reason=="string"?Ye.reason:""})}}};return window.addEventListener("message",ve),()=>window.removeEventListener("message",ve)},[]),z.useEffect(()=>{ds(null),_i(null),Ae(null),_s(null),Qe(null),ei(!0),Ft(!1),pt.current=!1,Ze(null),te(1),me({x:0,y:0}),mt({zoom:1,x:0,y:0}),Je.current=!1},[e,W]);const Ms=ys&&ps?ys.nodes.find(ve=>ve.id===ps)??null:null;z.useEffect(()=>{var ve,$e;($e=(ve=at.current)==null?void 0:ve.contentWindow)==null||$e.postMessage({type:"sapiom-canvas:select",id:ps},"*")},[ps]);const Is=z.useCallback(()=>{var ve,$e;!x||!g||!e||Wv()||H||($e=(ve=at.current)==null?void 0:ve.contentWindow)==null||$e.postMessage({type:"sapiom:run-state",steps:x.steps,status:x.status,target:g},"*")},[x,g,e,H]);z.useEffect(()=>{Is()},[Is]);const Cs=gi??void 0,[sn,Di]=z.useState(new Set);z.useEffect(()=>Vv(I),[]),z.useEffect(()=>{var $e;if(U(!0),!e){q(!1),($e=V.current)==null||$e.call(V,!1);return}q(!1);let ve=!1;return D(!0),fetch(`/canvas/${e}/`,{method:"HEAD"}).then(Be=>{var Fe;ve||(q(Be.ok),Be.ok||(Fe=V.current)==null||Fe.call(V,!1))}).catch(()=>{}).finally(()=>!ve&&D(!1)),()=>{ve=!0}},[e]),z.useEffect(()=>{!t||!e||t.type==="canvas.reload"&&t.harnessSessionId===e&&(q(!0),U(!0),Q(ve=>ve+1))},[t,e]);const li=(i==null?void 0:i.path)??null;z.useEffect(()=>{U(!0),Q(ve=>ve+1),te(1),me({x:0,y:0}),mt({zoom:1,x:0,y:0}),Je.current=!1},[li]);const oe=m.filter(ve=>ve.harnessSessionId===e&&(ve.workflowPath==null||ve.workflowPath===li)),fe=oe.some(ve=>ve.status==="running"&&ve.macroId==="describe"),ye=oe.find(ve=>ve.status==="running"&&ve.macroId!=="describe")??null,xe=oe.filter(ve=>ve.status!=="running"&&ve.macroId!=="describe").sort((ve,$e)=>($e.endedAt??"").localeCompare(ve.endedAt??""))[0],Te=!ye&&(xe==null?void 0:xe.status)==="failed"&&!sn.has(xe.id)?xe:null,ct=Te?d.find(ve=>ve.id===Te.macroId)??null:null,xt=d.find(ve=>ve.id==="visualize")??null,Dt=e!=null&&!0,Rt=B&&Dt,Ct=h.jsx(h.Fragment,{children:k&&h.jsx(gT,{deployState:k,workflow:i,onDismiss:A,onOpenCode:C})});return h.jsxs("aside",{className:"canvas-pane",...$t({surface:"canvas"}),children:[i&&!o&&h.jsx(TT,{workflow:i,detailStep:null,onBack:()=>{},onAskAgent:v,surface:w,stepsSummary:ys&&ys.nodes.length>0?dA(ys):null,run:x,runTarget:g,runs:b,onSelectRun:p}),r?h.jsx(Zi,{className:"canvas-empty",testId:"canvas-empty-no-session",icon:"Radio",title:`No running session for ${r}`,body:w==="steps"?"Start a session to map this agent's steps here.":"Start a session to map, run, and inspect this agent."}):o||!e?w==="steps"?h.jsx(Zi,{className:"canvas-empty",icon:"Radio",title:"No session",body:"Start a session to see the agent's steps here."}):h.jsx(Zi,{className:"canvas-empty",icon:"Radio",title:"No session",body:"Start a session to see its canvas here."}):Te?h.jsxs("div",{className:"canvas-task-failed","data-testid":"canvas-task-failed",children:[h.jsxs("p",{className:"canvas-task-title",children:[h.jsx(de,{name:"TriangleAlert",size:14})," ",Te.label," failed."]}),Te.errorTail&&h.jsx("pre",{className:"canvas-task-error",children:Te.errorTail}),h.jsxs("div",{className:"canvas-task-actions",children:[ct&&h.jsx("button",{className:"btn-primary","data-testid":"canvas-task-retry",onClick:()=>y(ct),children:"Retry"}),h.jsx("button",{className:"btn-ghost","data-testid":"canvas-task-dismiss",onClick:()=>Di(ve=>{const $e=new Set(ve);return $e.add(Te.id),$e}),children:"Dismiss"})]})]}):ye&&!Rt?h.jsxs("div",{className:"canvas-task-activity","data-testid":"canvas-task-activity",children:[h.jsx("span",{className:"canvas-task-icon","aria-hidden":"true",children:h.jsx(de,{name:"Workflow",size:20})}),h.jsx("div",{className:"canvas-task-title",children:h.jsxs("span",{children:[ye.label," is running…"]})}),ye.statusLines.length>0&&h.jsx("ul",{className:"canvas-task-lines","data-testid":"canvas-task-lines",children:ye.statusLines.slice(-8).map((ve,$e)=>h.jsx("li",{children:ve},`${$e}-${ve}`))}),h.jsx("p",{className:"canvas-empty-hint",children:"Running as a background task, so your session stays free. The canvas reloads here when it finishes."})]}):P?h.jsxs("div",{className:"canvas-loading","data-testid":"canvas-loading",children:[h.jsx("span",{className:"canvas-task-spinner","aria-hidden":"true"}),h.jsx("p",{className:"canvas-empty-hint",children:w==="steps"?"Loading steps…":"Loading canvas…"})]}):!Rt&&w==="steps"&&(x||k)?h.jsx("div",{className:"canvas-frame-wrap","data-view":"steps",children:h.jsxs("div",{className:"canvas-steps-surface","data-testid":"canvas-steps-surface",children:[Ct,x&&h.jsx(Cb,{run:x,target:g,workflow:i,focus:f,onToggleFocus:l,onAskAgent:v,onInspectionOpened:()=>Os("run.inspection_opened",{target:g??"unknown"}),onArtifactViewed:()=>Os("run.artifact_viewed",{target:g??"unknown"}),onDashboardOpened:()=>Os("run.dashboard_opened",{target:g??"unknown"})})]})}):!Rt&&c?h.jsx(Zi,{className:"canvas-empty",testId:"canvas-empty-exited",icon:"History",title:"Session ended",body:`Resume the session to see ${w==="steps"?"the agent's steps":"the agent's diagram"} here.`}):Rt?h.jsx("div",{className:"canvas-frame-wrap"+(f&&w==="board"?" is-expanded":""),"data-view":w==="board"?"board":"steps",children:h.jsx("div",{className:"canvas-slide-track",children:h.jsxs("div",{className:"canvas-slide-pane",children:[h.jsxs("div",{className:"canvas-visual"+(w==="steps"?" is-offstage":""),children:[h.jsxs("div",{className:"canvas-view-controls","data-testid":"canvas-view-controls",children:[h.jsx("button",{className:"theme-toggle","data-testid":"canvas-zoom-out","aria-label":"Zoom out",title:"Zoom out",disabled:X<=Ee+.001,onClick:()=>{Je.current=!0,te(ve=>Math.max(Ee,Math.round((ve-.25)*100)/100))},children:h.jsx(de,{name:"ZoomOut",size:14})}),h.jsxs("button",{className:"theme-toggle canvas-zoom-reset","data-testid":"canvas-zoom-reset","aria-label":"Reset zoom",title:"Reset zoom",disabled:X===1,onClick:()=>{Je.current=!0,te(1)},children:[Math.round(X*100),"%"]}),h.jsx("button",{className:"theme-toggle","data-testid":"canvas-zoom-in","aria-label":"Zoom in",title:"Zoom in",disabled:X>=2,onClick:()=>{Je.current=!0,te(ve=>Math.min(2,Math.round((ve+.25)*100)/100))},children:h.jsx(de,{name:"ZoomIn",size:14})}),h.jsx("button",{className:"theme-toggle","data-testid":"canvas-fit","aria-label":"Fit to view",title:"Fit to view",disabled:X===wt.zoom&&ue.x===wt.x&&ue.y===wt.y,onClick:Mt,children:h.jsx(de,{name:"Frame",size:14})})]}),f&&h.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:l,children:h.jsx(de,{name:"Minimize2",size:14})}),(H||L)&&h.jsxs("div",{className:"canvas-skeleton canvas-loading--overlay"+(H?"":" is-fading"),"data-testid":"canvas-loading",role:"status","aria-label":"Rendering diagram",children:[h.jsx("div",{className:"canvas-skeleton-block canvas-skeleton-title"}),h.jsxs("div",{className:"canvas-skeleton-row",children:[h.jsx("div",{className:"canvas-skeleton-block"}),h.jsx("div",{className:"canvas-skeleton-block"})]}),h.jsxs("div",{className:"canvas-skeleton-row",children:[h.jsx("div",{className:"canvas-skeleton-block"}),h.jsx("div",{className:"canvas-skeleton-block"}),h.jsx("div",{className:"canvas-skeleton-block"})]}),h.jsx("div",{className:"canvas-skeleton-block canvas-skeleton-wide"})]}),Ls&&h.jsxs("div",{className:"canvas-render-error","data-testid":"canvas-render-error",children:[h.jsx("span",{className:"canvas-error-icon","aria-hidden":"true",children:h.jsx(de,{name:"TriangleAlert",size:20})}),h.jsx("div",{className:"canvas-task-title",children:"Render failed"}),h.jsx("p",{className:"canvas-error-summary",children:(()=>{const ve=Ls.reason.trim();return ve.length<4?"The agent graph could not be extracted. Open the terminal for details.":ve.includes(": ")?ve.slice(ve.indexOf(": ")+2).split(". ")[0]:ve})()}),h.jsxs("div",{className:"canvas-error-actions",children:[h.jsx("button",{className:"btn-primary","data-testid":"canvas-error-fix",onClick:()=>v(`The canvas render for ${Ls.title||"this agent"} failed: ${Ls.reason} Fix the project so the agent graph extracts cleanly.`),children:"Ask coding agent to fix"}),h.jsx("button",{className:"btn-ghost","data-testid":"canvas-error-retry",onClick:()=>{xt?y(xt):(F.current=Date.now()+900,U(!0),Q(ve=>ve+1))},children:"Retry"})]}),h.jsxs("details",{className:"canvas-error-details",children:[h.jsx("summary",{children:"Details"}),h.jsx("pre",{children:Ls.reason.trim().length>=4?Ls.reason:"The rendered document reported a failure without details. Re-render the diagram or check the terminal."})]})]}),ye&&h.jsxs("div",{className:"canvas-task-activity canvas-task-activity--overlay","data-testid":"canvas-task-activity",children:[h.jsx("span",{className:"canvas-task-icon","aria-hidden":"true",children:h.jsx(de,{name:"Workflow",size:20})}),h.jsx("div",{className:"canvas-task-title",children:h.jsxs("span",{children:[ye.label," is running…"]})}),ye.statusLines.length>0&&h.jsx("ul",{className:"canvas-task-lines","data-testid":"canvas-task-lines",children:ye.statusLines.slice(-8).map((ve,$e)=>h.jsx("li",{children:ve},`${$e}-${ve}`))}),h.jsx("p",{className:"canvas-empty-hint",children:"Running as a background task, so your session stays free. The canvas reloads here when it finishes."})]}),Cs&&!Qs&&!Ms&&h.jsx("button",{className:"theme-toggle canvas-overview-open","data-testid":"canvas-overview-toggle","aria-label":"Show agent overview","data-tooltip":"Show agent overview",onClick:()=>ei(!0),children:"i"}),w==="board"&&h.jsx("button",{className:"theme-toggle canvas-chat-toggle"+(Ks?" is-active":""),"data-testid":"canvas-chat-toggle","aria-label":Ks?"Close chat":"Open chat","data-tooltip":"Chat — ask about this agent or the selected step",onClick:()=>$s(ve=>!ve),children:h.jsx(de,{name:"MessageSquare",size:14})}),h.jsx("iframe",{ref:at,className:"canvas-iframe",src:`/canvas/${e}/?theme=${ie}`,sandbox:"allow-scripts",scrolling:"no",onLoad:()=>{var ve,$e,Be,Fe;ae(),($e=(ve=at.current)==null?void 0:ve.contentWindow)==null||$e.postMessage({type:"sapiom-canvas:view",zoom:X,x:ue.x,y:ue.y},"*"),x&&g&&e&&((Fe=(Be=at.current)==null?void 0:Be.contentWindow)==null||Fe.postMessage({type:"sapiom:run-state",steps:x.steps,status:x.status,target:g},"*"))},onError:le},`${e}:${W}`),h.jsx("div",{ref:Le,className:"canvas-pan-layer"+(je?" is-panning":""),"data-testid":"canvas-pan-layer","data-over-node":hs&&!je?"true":void 0,onPointerDown:jt,onPointerMove:Ns,onPointerLeave:fs,onDoubleClick:Mt})]}),w==="steps"&&h.jsxs("div",{className:"canvas-steps-surface","data-testid":"canvas-steps-surface",children:[Ct,x?h.jsx(Cb,{run:x,target:g,workflow:i,focus:f,onToggleFocus:l,onAskAgent:v,onInspectionOpened:()=>Os("run.inspection_opened",{target:g??"unknown"}),onArtifactViewed:()=>Os("run.artifact_viewed",{target:g??"unknown"}),onDashboardOpened:()=>Os("run.dashboard_opened",{target:g??"unknown"})}):ys&&ys.nodes.length>0?h.jsx(wT,{graph:ys,run:x,runTarget:g,workflows:N,onOpenWorkflow:j,onAskAgent:v,expandedId:Pe,onToggle:ve=>Qe($e=>$e===ve?null:ve)}):h.jsx(Zi,{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."})]}),w==="board"&&(Cs&&Qs||Ms)&&h.jsx(kT,{overview:Cs??null,selectedNode:Ms,graph:ys,run:x,workflows:N,onOpenWorkflow:j,onOpenSteps:()=>{ps&&Qe(ps),R()},onDeselect:()=>_s(null),onCollapse:()=>ei(!1),onDescribeWithAI:i&&e&&!c?()=>S(i):void 0,describing:fe}),w==="board"&&Ks&&h.jsx(ET,{node:Ms,run:x,onInjectPrompt:v,onClose:()=>$s(!1)})]})})}):h.jsx(Zi,{className:"canvas-empty",icon:"Workflow",title:w==="steps"?"No steps yet":"Nothing generated yet",body:w==="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 g4="https://tools.sapiom.ai",_4="x-sapiom-api-key",y4="YOUR_SAPIOM_API_KEY";function b4(e){return e==null?"{ /* your input */ }":JSON.stringify(e,null,2).replace(/\n/g,`
455
+ `)}function S4(e){return e==null?"{}":JSON.stringify(e)}function w4(e){return e.replace(/'/g,"'\\''")}function x4(e,t){return`import { agents } from "@sapiom/tools";
456
+
457
+ const result = await agents.run({
458
+ definition: ${JSON.stringify(e)},
459
+ input: ${b4(t)},
460
+ });
461
+
462
+ if (result.status === "completed") {
463
+ console.log(result.output);
464
+ }
465
+ `}function C4(e,t,i){const r=w4(`{ "input": ${S4(t)} }`),o=encodeURIComponent(e);return`curl -X POST ${i}/agents/v1/definitions/${o}/executions \\
466
+ -H "${_4}: ${y4}" \\
467
+ -H "Content-Type: application/json" \\
468
+ -d '${r}'
469
+ `}function E4(e){const{definition:t,inputSample:i,baseUrl:r=g4}=e;return{typescript:x4(t,i),curl:C4(t,i,r)}}const k4=new Set(["pending","queued","building"]),A4=new Set(["failed","cancelled","superseded","stale"]);function wo(e,t=null){return e.activeBuildRunStatus==="ready"?"ready":e.activeBuildRunStatus!=null&&k4.has(e.activeBuildRunStatus)?"building":t!=null||e.activeBuildRunStatus!=null&&A4.has(e.activeBuildRunStatus)?"failed":e.definitionId==null?"draft":"linked"}function zd(e){return(e==null?void 0:e.activeBuildRunStatus)==="ready"}function M1(e,t=null){switch(wo(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 j4="https://app.sapiom.ai/settings?tab=api-keys";function R4({boundWorkflow:e,agentsBaseUrl:t}){return zd(e)?h.jsx(T4,{boundWorkflow:e,agentsBaseUrl:t}):null}function T4({boundWorkflow:e,agentsBaseUrl:t}){const[i,r]=z.useState("typescript"),[o,c]=z.useState(!1),f=e.definitionSlug==null,l=e.definitionSlug??e.name,{typescript:d,curl:m}=E4({definition:l,baseUrl:t}),y=i==="typescript"?d:m,v=()=>{navigator.clipboard.writeText(y).then(()=>{c(!0),window.setTimeout(()=>c(!1),2e3)}).catch(()=>{})};return h.jsxs("div",{className:"snippet-panel","data-testid":"snippet-panel",...$t({object:"snippet"}),children:[h.jsx("div",{className:"snippet-panel-header",children:h.jsx("span",{className:"snippet-panel-title",children:"Trigger from your code"})}),h.jsxs("div",{className:"snippet-slug-row",children:[h.jsx("span",{className:"snippet-slug-label",children:"Agent"}),h.jsx("code",{className:"snippet-slug","data-testid":"snippet-slug",children:l})]}),f&&h.jsx("p",{className:"snippet-slug-inferred","data-testid":"snippet-slug-inferred",children:"Inferred from the project name. Confirm it matches your deployed agent."}),h.jsxs("div",{className:"snippet-tabs",role:"tablist","aria-label":"Snippet language",children:[h.jsx("button",{role:"tab","aria-selected":i==="typescript","aria-controls":"snippet-code-panel",className:"snippet-tab"+(i==="typescript"?" is-active":""),"data-testid":"snippet-tab-ts",onClick:()=>r("typescript"),children:"TypeScript (SDK)"}),h.jsx("button",{role:"tab","aria-selected":i==="curl","aria-controls":"snippet-code-panel",className:"snippet-tab"+(i==="curl"?" is-active":""),"data-testid":"snippet-tab-curl",onClick:()=>r("curl"),children:"cURL (HTTP)"})]}),h.jsxs("div",{className:"snippet-code-wrap",role:"tabpanel",id:"snippet-code-panel",children:[h.jsx("pre",{className:"snippet-code","data-testid":"snippet-code",children:h.jsx("code",{children:y})}),h.jsx("button",{className:"snippet-copy"+(o?" is-copied":""),"data-testid":"snippet-copy","aria-label":o?"Copied":"Copy snippet",onClick:v,children:o?"Copied":"Copy"})]}),h.jsxs("p",{className:"snippet-hint","data-testid":"snippet-hint",children:[i==="typescript"?h.jsxs(h.Fragment,{children:["Install ",h.jsx("code",{children:"@sapiom/tools"}),", set ",h.jsx("code",{children:"SAPIOM_API_KEY"}),", and replace the sample input. The SDK call waits for a terminal run and returns its result."]}):h.jsxs(h.Fragment,{children:["Replace ",h.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"," ",h.jsx("a",{className:"snippet-link","data-testid":"snippet-api-key-link",href:j4,target:"_blank",rel:"noreferrer",children:"Sapiom dashboard"}),"."]})]})}function N4({boundWorkflow:e,noSessionAgent:t=null,agentsBaseUrl:i,lastDeployError:r=null}){if(!e)return h.jsx(Zi,{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=wo(e,r),c=o==="ready",f=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",d=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 h.jsxs("div",{className:"code-panel",...$t({surface:"code_panel"}),children:[h.jsxs("div",{className:"workflow-actions-header code-panel-header","data-testid":"code-panel-header",children:[h.jsx("span",{className:"workflow-actions-name",children:e.name}),c?h.jsxs("span",{className:"status-tag workflow-deployed-tag","data-testid":"code-panel-status","data-tooltip":"Ready cloud build",children:[h.jsx("span",{className:"workflow-dot workflow-dot-pinned","aria-hidden":"true"}),"Deployed"]}):h.jsxs("span",{className:"status-tag code-panel-draft-tag","data-testid":"code-panel-status","data-tooltip":l,children:[h.jsx(de,{name:"CloudOff",size:13}),f]})]}),c?h.jsx("div",{className:"code-panel-body","data-testid":"code-panel-body",children:h.jsx(R4,{boundWorkflow:e,agentsBaseUrl:i},e.path)}):h.jsx(Zi,{className:"code-panel-empty",icon:"Code",title:l,body:d})]})}const M4="https://docs.sapiom.ai/",D4=[{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"}],Rv=1,Tv=12,FC=10,VC=20,O4=25,$4=e=>-(3+Math.min(e,9)),L4=new Set(["/","\\","-","_",".",":"," "]),D1=e=>e>="0"&&e<="9",I4=e=>e!==e.toUpperCase()&&e===e.toLowerCase(),P4=e=>e!==e.toLowerCase()&&e===e.toUpperCase();function B4(e){const t=new Array(e.length);for(let i=0;i<e.length;i++){if(i===0){t[i]=!0;continue}const r=e[i-1],o=e[i];t[i]=L4.has(r)||D1(o)!==D1(r)||P4(o)&&I4(r)}return t}function H4(e,t,i,r){var S;const o=e.length,c=t.length,f=(w,R)=>{let x=Rv;i[R]&&(x+=Tv),R===w+1&&(x+=FC);const g=R-w-1;return g>=1&&(x+=$4(g)),x},l=new Map,d=(w,R)=>{if(w===o-1)return 0;const x=w*c+R,g=l.get(x);if(g!==void 0)return g.score;const b=e[w+1];let p=Number.NEGATIVE_INFINITY,_=-1;if(R+1<c&&t[R+1]===b){const k=f(R,R+1)+d(w+1,R+1);k>p&&(p=k,_=R+1)}for(const k of r.get(b)??[]){if(k<=R+1)continue;const A=f(R,k)+d(w+1,k);A>p&&(p=A,_=k)}return l.set(x,{score:p,next:_}),p};let m=Number.NEGATIVE_INFINITY,y=-1;for(const w of r.get(e[0])??[]){const x=Rv+Tv+(w===0?VC:0)+d(0,w);x>m&&(m=x,y=w)}if(y===-1||!Number.isFinite(m))return null;const v=[y];for(let w=0,R=y;w<o-1;w++){const x=((S=l.get(w*c+R))==null?void 0:S.next)??-1;v.push(x),R=x}return{score:m,indices:v}}function z4(e,t,i){let r=null;for(let c=0;;){const f=t.indexOf(e,c);if(f===-1)break;let l=f===0?VC:0;for(let d=0;d<e.length;d++)l+=Rv,i[f+d]&&(l+=Tv),d>0&&(l+=FC);(r===null||l>r.score)&&(r={score:l,start:f}),c=f+1}if(r===null)return null;const o=r.start;return{score:r.score,indices:Array.from({length:e.length},(c,f)=>o+f)}}function bm(e){let t="";for(let i=0;i<e.length;i++){const r=e[i].toLowerCase();t+=r.length===1?r:e[i]}return t}function O1(e,t){const i=[...new Set(bm(e).split(/\s+/).filter(Boolean))];if(i.length===0)return{score:0,indices:[]};if(!t)return null;const r=bm(t),o=B4(t),c=new Map;for(let d=0;d<t.length;d++){if(!o[d])continue;const m=r[d],y=c.get(m);y?y.push(d):c.set(m,[d])}let f=0;const l=new Set;for(const d of i){if(d.length>r.length)return null;const m=H4(d,r,o,c),y=z4(d,r,o),v=m&&y?m.score>=y.score?m:y:m??y;if(!v)return null;f+=v.score;for(const S of v.indices)l.add(S)}return bm(e.trim())===r&&(f+=O4),{score:f,indices:[...l].sort((d,m)=>d-m)}}function WC(e){return e.includes("\\")?"\\":"/"}function U4(e,t){return`${e.trim().replace(/[\\/]+$/,"")}${WC(e)}${t.trim()}`}function Gn(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function GC(e){const t=e.replace(/[\\/]+$/,"");if(t===""||/^[A-Za-z]:$/.test(t))return null;const i=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));if(i<0)return null;const r=t.slice(0,i);return/^[A-Za-z]:$/.test(r)?r+t[i]:r||"/"}function nc(e){const t=e.replace(/[\\/]+$/,"");return t===e?e:t===""?e[0]:/^[A-Za-z]:$/.test(t)?t+e[t.length]:t}function Nv(e,t){return nc(e.replace(/\\/g,"/"))===nc(t.replace(/\\/g,"/"))}function mg(e,t){const i=nc(e.replace(/\\/g,"/")),r=nc(t.replace(/\\/g,"/"));return r===i?!0:i.endsWith("/")?r.startsWith(i):r.startsWith(`${i}/`)}function q4(e){return e.startsWith("/")||e.startsWith("~")||/^[A-Za-z]:[\\/]/.test(e)}function F4(e){const t=WC(e),i=e.split(/[\\/]/).filter(Boolean);return i.length<=2?e:`${t==="\\"?"":t}${i[0]}${t}…${t}${i[i.length-1]}`}function $1(e,t){var i;return(i=t[e.id])!=null&&i.trim()?!1:!e.title||e.title===Gn(e.cwd)}function mh(e,t,i){var l;const r=(l=i[e.id])==null?void 0:l.trim();if(r)return r;if(!$1(e,i))return e.title;const o=Gn(e.cwd),f=t.filter(d=>d.cwd===e.cwd&&(d.status!=="exited"||d.id===e.id)&&$1(d,i)).sort((d,m)=>d.createdAt.localeCompare(m.createdAt)||d.id.localeCompare(m.id)).findIndex(d=>d.id===e.id);return f>0?`${o} ${f+1}`:o}const Sm=Gn,Ud=(e,t)=>mg(t,e),Mv=e=>(t,i)=>e==="name"?t.name.localeCompare(i.name):t.path.localeCompare(i.path);function V4(e,t,i="workspace",r="recent",o=[],c=[]){return i==="deployment"?W4(e,r):G4(e,t,r,o,c)}function W4(e,t){const i=Mv(t),r=(c,f,l)=>({cwd:`deployment:${f}`,label:c,isDirectory:!1,agents:e.filter(l).sort(i).map(d=>({workflow:d})),bareSessions:[]});return{workspaces:[r("Deployed","live",c=>c.definitionId!=null),r("Draft","draft",c=>c.definitionId==null)].filter(c=>c.agents.length>0),orphanAgents:[]}}function G4(e,t,i,r,o=[]){const c=t.filter(g=>g.status!=="exited"),f=new Set(e),l=new Set(o),d=new Map(o.map((g,b)=>[g,b])),m=new Map;for(const g of t){const b=m.get(g.cwd);(!b||g.createdAt>b)&&m.set(g.cwd,g.createdAt)}const y=new Set([...m.keys(),...r,...o]),v=(g,b)=>{const p=r.indexOf(g),_=r.indexOf(b);return p>=0&&_>=0?p-_:p>=0||_>=0?p>=0?-1:1:(m.get(b)??"").localeCompare(m.get(g)??"")},S=Array.from(y).sort((g,b)=>{const p=d.get(g),_=d.get(b);return p!==void 0||_!==void 0?p!==void 0&&_!==void 0?p-_:p!==void 0?-1:1:i==="name"?Sm(g).localeCompare(Sm(b))||g.localeCompare(b):v(g,b)||g.localeCompare(b)}),w=g=>{let b=null;for(const p of S)Ud(g,p)&&(b===null||p.length>b.length)&&(b=p);return b},R=[];for(const g of S){const b=e.filter(k=>f.has(k)&&w(k.path)===g).sort(Mv(i)).map(k=>(f.delete(k),{workflow:k})),p=c.filter(k=>k.boundWorkflowPath==null&&w(k.cwd)===g).sort((k,A)=>A.createdAt.localeCompare(k.createdAt)||k.id.localeCompare(A.id)),_=l.has(g)&&b.length===0&&p.length===0;b.length===0&&p.length===0&&!_||R.push({cwd:g,label:Sm(g),isDirectory:!0,agents:b,bareSessions:p,pending:_})}const x=Array.from(f).sort(Mv(i)).map(g=>({workflow:g}));return{workspaces:R,orphanAgents:x}}const Nl=[{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"}],K4={templates:{label:"Browse templates",actionId:"browse-templates"},docs:{label:"Open documentation",href:M4}},Y4=6,X4=6,Nu=20,J4=6,KC=36e5,wm=24*KC;function L1(e,t){if(t<=0)return 0;const i=e-t;return i<=KC?30:i<=wm?20:i<=7*wm?12:i<=30*wm?6:0}const Mu=e=>{const t=Date.parse(e);return Number.isNaN(t)?0:t},Z4=(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 Q4(e){const{sessions:t,workflows:i,history:r,recentDirs:o,sessionNames:c,actions:f,templates:l,activeSessionId:d}=e,m=t.filter(C=>C.status!=="exited").map(C=>({id:`session:${C.id}`,kind:"session",label:mh(C,t,c),meta:C.cwd,sessionId:C.id,current:C.id===d||void 0,recency:Mu(C.lastActiveAt)})),y=new Set(t.map(C=>C.id)),v=new Set(t.map(C=>C.agentSessionId).filter(C=>C!=null)),S=[...t.filter(C=>C.status==="exited").map(C=>({item:{id:`past:${C.id}`,kind:"past",label:mh(C,t,c),meta:C.cwd,sessionId:C.id,recency:Mu(C.lastActiveAt)},cwd:C.cwd,count:0,fromRegistry:!0})),...r.filter(C=>!(C.harnessSessionId!=null&&y.has(C.harnessSessionId))&&!v.has(C.agentSessionId)).map(C=>{var N;return{item:{id:`summary:${C.agentSessionId}`,kind:"past",label:((N=c[C.harnessSessionId??""])==null?void 0:N.trim())||C.title,meta:C.cwd,summary:C,recency:Mu(C.lastActiveAt)},cwd:C.cwd,count:C.turnCount??C.messageCount??0,fromRegistry:!1}})],w=new Map;for(const C of S){const N=`${C.item.label.trim()}\0${C.cwd}`,j=w.get(N);(!j||Z4(C,j))&&w.set(N,C)}const R=[...w.values()].map(C=>C.item).sort((C,N)=>N.recency-C.recency),x=C=>{let N=0;for(const M of t){if(M.boundWorkflowPath!==C.path&&!Ud(M.cwd,C.path))continue;const O=Mu(M.lastActiveAt);O>N&&(N=O)}if(N>0)return N;const j=o.findIndex(M=>Ud(C.path,M)||Ud(M,C.path));return j===-1?0:o.length-j},g=i.map(C=>({id:`agent:${C.path}`,kind:"agent",label:Xv(C.name),meta:C.path,path:C.path,recency:x(C)})),b=new Set(i.map(C=>C.path)),p=o.filter(C=>!b.has(C)).map(C=>({id:`recent:${C}`,kind:"recent",label:Gn(C),meta:C,path:C,recency:o.length-o.indexOf(C)})),_=f.map(C=>({id:`command:${C.id}`,kind:"command",label:C.label,meta:C.meta??"",icon:C.icon,run:C.run,recency:0})),k=D4.map(C=>({id:`doc:${C.href}`,kind:"doc",label:C.label,meta:C.meta,href:C.href,recency:0})),A=l.map(C=>({id:`template:${C.id}`,kind:"template",label:C.name,meta:C.description,templateId:C.id,recency:0}));return[...m,...R,...g,...p,...A,...k,..._]}const I1={session:0,agent:1,past:2,recent:3,template:4,doc:5,command:6,path:7},e5={all:["session","agent","past","recent","template","doc","command"],sessions:["session","past"],agents:["agent"],templates:["template"],docs:["doc"],files:["recent"],actions:["command"]},Dv=(e,t)=>e.filter(i=>i.kind===t);function Xr(e,t){const i=Dv(e,t);return t==="session"?i.sort((r,o)=>(r.current?1:0)-(o.current?1:0)||o.recency-r.recency):t==="past"?i.sort((r,o)=>o.recency-r.recency):t==="agent"?i.sort((r,o)=>o.recency-r.recency||r.label.localeCompare(o.label)):t==="recent"?i.sort((r,o)=>o.recency-r.recency):i}function t5(e,t,i={}){const r=i.filter??"all",o=i.now??Date.now(),c=e5[r],f=e.trim();if(!f){if(r!=="all")return c.flatMap(v=>Xr(t,v)).slice(0,Nu);const y=Dv(t,"command");return[...Xr(t,"session"),...Xr(t,"past").slice(0,Y4),...Xr(t,"agent").slice(0,J4),...Xr(t,"recent"),...Xr(t,"template"),...Xr(t,"doc")].slice(0,Math.max(0,Nu-y.length)).concat(y)}const l=y=>{const v=O1(f,y.label);if(v)return{item:{...y,labelIndices:v.indices},fieldRank:0,boosted:v.score+L1(o,y.recency),matchedLength:y.label.length};const S=y.meta?O1(f,y.meta):null;return S?{item:{...y,metaIndices:S.indices},fieldRank:1,boosted:S.score+L1(o,y.recency),matchedLength:y.meta.length}:null},d=c.map(y=>({kind:y,scored:Dv(t,y).map(l).filter(v=>v!==null).sort((v,S)=>v.fieldRank-S.fieldRank||S.boosted-v.boosted||S.item.recency-v.item.recency||v.matchedLength-S.matchedLength||v.item.label.localeCompare(S.item.label))})).filter(y=>y.scored.length>0),m=d.length>1?X4:Nu;return d.sort((y,v)=>{const S=y.scored[0],w=v.scored[0];return S.fieldRank-w.fieldRank||w.boosted-S.boosted||I1[y.kind]-I1[v.kind]}).flatMap(y=>y.scored.slice(0,m).map(v=>v.item)).slice(0,Nu)}function s5(e,t){const i=e.trim();return[...i?[{id:`confirm:${i}`,kind:"path",label:i,meta:"Open this path",path:i,recency:0}]:[],...t.map(o=>({id:`dir:${o.path}`,kind:"path",label:o.name,meta:o.path,path:o.path,recency:0}))]}function i5(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 n5=/^[a-z0-9][a-z0-9-]{0,213}$/,vg="sapiom-agent",r5=3,P1=32,a5=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 YC(e){return n5.test(e)}function o5(e){var f;const t=e.toLowerCase().replace(/[^a-z0-9]+/g," ").split(" ").filter(Boolean),i=t.filter(l=>!a5.has(l)),r=i.length>0?i:t,o=[];for(const l of r.slice(0,r5)){if((o.length===0?l:`${o.join("-")}-${l}`).length>P1)break;o.push(l)}const c=o.join("-")||((f=r[0])==null?void 0:f.slice(0,P1))||"";return YC(c)?c:vg}function XC(e,t){const i=(t==null?void 0:t.trim())??"",r=e.trim();return!i.replace(/[\\/]+$/,"")||!r?"":U4(i,r)}function l5(e){var t,i,r;return((t=e.settingsRoot)==null?void 0:t.trim())||((i=e.defaultProjectRoot)==null?void 0:i.trim())||((r=e.launchDir)==null?void 0:r.trim())||""}const c5=GC;function u5(e,t){const i=new Set(t);if(!i.has(e))return e;for(let r=2;r<1e3;r+=1){const o=`${e}-${r}`;if(!i.has(o)&&YC(o))return o}return e}const vh=[{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."}],d5={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 h5(e){return e?d5[e]??e.replace(/-/g," ").replace(/^./,t=>t.toUpperCase()):"Uncategorised"}function gg(e){return e!=null&&e.label?e.score>0?`${e.label} ${e.score}/5`:e.label:"—"}function JC(e){const{basis:t}=e,i=[];t.llmSteps>0&&i.push(`${t.llmSteps} model ${t.llmSteps===1?"step":"steps"}`),t.chainedLlmSteps>0&&i.push(`${t.chainedLlmSteps} chained`),t.mediaCapabilities>0&&i.push(`${t.mediaCapabilities} media ${t.mediaCapabilities===1?"generator":"generators"}`),i.push(`${t.stepCount} ${t.stepCount===1?"step":"steps"}`),t.capabilityCount>0&&i.push(`${t.capabilityCount} ${t.capabilityCount===1?"capability":"capabilities"}`);const r=t.llmSteps===0&&t.mediaCapabilities===0?" · deterministic":"";return`${i.join(", ")}${r}`}function f5(e){return`${e.label}: ${JC(e)}`}function B1(e,t){const i=t.trim().toLowerCase();return i?[e.name,e.description,e.id,...e.kind==="gallery"?e.tags:[],...e.kind==="gallery"?e.capabilities:[]].join(" ").toLowerCase().includes(i):!0}function p5(e,t){const i="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. `+i:`Scaffold the "${e.id}" starter in this directory: ${Ov(t,e.id)}, then run npm install and read AGENTS.md. Keep the shipped starter unchanged until the user describes what to build. `+i}function m5(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 Ov(e,t){return"call the sapiom_dev_agents_scaffold tool with "+JSON.stringify({dir:e,template:t})}function v5(e){var o,c;const t=e.steps.map(f=>({id:f.name,kind:f.kind,label:f.name,role:f.kind.startsWith("terminal")?"terminal":f.kind==="entry"?"entry":"step",description:f.description??"",timeoutMs:null,inputSchema:null,capabilities:f.capabilities})),i=new Map;for(const f of e.transitions)f.kind==="continue"&&i.set(f.from,(i.get(f.from)??0)+1);const r=e.transitions.map(f=>({from:f.from,to:f.to,kind:f.kind==="pause"?"cross":(i.get(f.from)??0)>1?"branching":"sequential",label:f.label??""}));return{name:e.name,entry:((o=e.steps.find(f=>f.kind==="entry"))==null?void 0:o.name)??((c=e.steps[0])==null?void 0:c.name)??"",nodes:t,edges:r,groups:[],warnings:[]}}function g5(e,t){const i=e.kind==="starter"&&e.id==="default"?vg:e.id;return XC(i,t)}function _5(e){const t=z.useRef(null),[i,r]=z.useState(null),o=z.useCallback(()=>{const l=t.current;if(!l)return;const d=l.querySelector('[aria-selected="true"]');if(!d){r(null);return}const m=l.getBoundingClientRect(),y=d.getBoundingClientRect();r({x:y.left-m.left+l.scrollLeft,w:y.width})},[]),c=z.useRef(null),f=z.useCallback(l=>{var d;(d=c.current)==null||d.disconnect(),t.current=l,l&&(o(),!(typeof ResizeObserver>"u")&&(c.current=new ResizeObserver(o),c.current.observe(l)))},[o]);return z.useLayoutEffect(()=>{o()},[e,o]),z.useLayoutEffect(()=>()=>{var l;return(l=c.current)==null?void 0:l.disconnect()},[]),{trackRef:f,style:i?{transform:`translateX(${i.x}px)`,width:`${i.w}px`,opacity:1}:{opacity:0}}}const y5={command:"Zap",doc:"BookOpen",session:"Radio",past:"History",agent:"Workflow",recent:"Folder",path:"Folder",template:"LayoutTemplate"},xm={command:"Actions",doc:"Documentation",session:"Sessions",past:"Past sessions",agent:"Agents",recent:"Folders",path:"Folders",template:"Templates"},b5=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),S5=b5?"⌘":"Ctrl";function H1(e,t){if(!t||t.length===0)return e;const i=new Set(t),r=[];let o="",c=i.has(0);const f=l=>{o&&(r.push(c?h.jsx("b",{className:"palette-match",children:o},l):o),o="")};for(let l=0;l<e.length;l++){const d=i.has(l);d!==c&&(f(l),c=d),o+=e[l]}return f(e.length),r}function w5({sessions:e,workflows:t,recentDirs:i,history:r,sessionNames:o,activeSessionId:c,actions:f,listDir:l,listTemplates:d,onSelectSession:m,onReviewSummary:y,onOpenPath:v,onOpenTemplate:S,onClose:w}){const[R,x]=z.useState(""),[g,b]=z.useState("all"),[p,_]=z.useState([]),[k,A]=z.useState([]),[C,N]=z.useState(!1),[j,M]=z.useState(!1),[O,B]=z.useState(0),q=_5(g),V=z.useRef(null);z.useEffect(()=>{var P;(P=V.current)==null||P.focus()},[]),z.useEffect(()=>{let P=!1;return _(vh.map(({id:D,name:H,description:U})=>({id:D,name:H,description:U}))),d().then(D=>{P||_([...D.templates.map(({id:H,name:U,description:L})=>({id:H,name:U,description:L})),...vh.map(({id:H,name:U,description:L})=>({id:H,name:U,description:L}))])}).catch(()=>{}),()=>{P=!0}},[d]);const J=q4(R);z.useEffect(()=>{if(!J){A([]),M(!1);return}let P=!1;N(!0),M(!1);const D=setTimeout(()=>{l(R).then(H=>{P||A(H.dirs)}).catch(()=>{P||(A([]),M(!0))}).finally(()=>!P&&N(!1))},150);return()=>{P=!0,clearTimeout(D)}},[R,J,l]);const ee=z.useMemo(()=>J?s5(R,k):t5(R,Q4({sessions:e,workflows:t,history:r,recentDirs:i,sessionNames:o,actions:f,templates:p,activeSessionId:c}),{filter:g}),[R,J,k,e,t,i,r,o,c,f,p,g]);z.useEffect(()=>{const P=ee.findIndex(D=>!D.current);B(P===-1?0:P)},[ee,R,g]);const W=J?void 0:K4[g],Q=P=>{const D=i5(P);switch(D.type){case"run":D.run();break;case"open-href":window.open(D.href,"_blank","noopener,noreferrer");break;case"open-template":S(D.templateId);break;case"select-session":m(D.sessionId);break;case"review-summary":y(D.summary);break;case"open-path":v(D.path);break}w()},ie=P=>{b(D=>{const U=(Nl.findIndex(L=>L.id===D)+P+Nl.length)%Nl.length;return Nl[U].id})},I=P=>{if(P.key==="ArrowDown")P.preventDefault(),B(D=>Math.min(D+1,ee.length-1));else if(P.key==="ArrowUp")P.preventDefault(),B(D=>Math.max(D-1,0));else if(P.key==="Tab"&&!J)P.preventDefault(),ie(P.shiftKey?-1:1);else if(P.key==="Enter"){P.preventDefault();const D=ee[O];D&&Q(D)}else P.key==="Escape"&&(R?x(""):w())};return h.jsx("div",{className:"modal-backdrop",onClick:w,children:h.jsxs("div",{className:"modal command-palette",onClick:P=>P.stopPropagation(),...$t({dialog:"command_palette"}),children:[h.jsxs("div",{className:"command-palette-search",children:[h.jsx(de,{name:"Search",size:16}),h.jsx("input",{ref:V,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:R,onChange:P=>x(P.target.value),onKeyDown:I}),R&&h.jsx("button",{type:"button",className:"command-palette-clear","data-testid":"command-palette-clear","aria-label":"Clear search",onClick:()=>{var P;x(""),(P=V.current)==null||P.focus()},children:h.jsx(de,{name:"X",size:14})})]}),!J&&h.jsxs("div",{ref:q.trackRef,className:"command-palette-filters tab-track",role:"tablist","aria-label":"Search filter",children:[h.jsx("span",{className:"tab-indicator",style:q.style,"aria-hidden":"true"}),Nl.map(P=>h.jsxs("button",{type:"button",role:"tab","aria-selected":g===P.id,className:"command-palette-filter"+(g===P.id?" is-active":""),"data-testid":`command-palette-filter-${P.id}`,onClick:()=>{var D;b(P.id),(D=V.current)==null||D.focus()},children:[h.jsx(de,{name:P.icon,size:14}),P.label]},P.id))]}),h.jsxs("div",{className:"command-palette-list","data-testid":"command-palette-list",children:[J&&C&&h.jsx("div",{className:"command-palette-empty",children:"Loading…"}),J&&j&&!C&&h.jsx("div",{className:"command-palette-error","data-testid":"command-palette-error",role:"alert",children:"Couldn't read that path."}),ee.length===0&&!C&&!j&&h.jsx("div",{className:"command-palette-empty",children:"No matches"}),ee.map((P,D)=>h.jsxs("div",{className:"command-palette-row",children:[!J&&(D===0||xm[P.kind]!==xm[ee[D-1].kind])&&h.jsx("div",{className:"command-palette-section","data-testid":"command-palette-section",children:xm[P.kind]}),h.jsxs("button",{type:"button",className:"command-palette-item"+(D===O?" is-selected":"")+(P.current?" is-current":""),"data-testid":`command-palette-item-${D}`,onMouseEnter:()=>B(D),onClick:()=>Q(P),children:[h.jsx(de,{name:P.icon??y5[P.kind],size:14}),h.jsx("span",{className:"command-palette-item-label",children:H1(P.label,P.labelIndices)}),P.current&&h.jsx("span",{className:"command-palette-current",children:"current"}),h.jsx("span",{className:"command-palette-item-meta","data-code":P.path!=null||P.kind==="session"||P.kind==="past"||void 0,children:P.meta?H1(P.meta,P.metaIndices):null})]})]},P.id))]}),h.jsxs("div",{className:"command-palette-footer","data-testid":"command-palette-footer",children:[h.jsxs("span",{children:[h.jsx("kbd",{children:"↑"}),h.jsx("kbd",{children:"↓"})," navigate"]}),!J&&h.jsxs("span",{children:[h.jsx("kbd",{children:"tab"})," category"]}),h.jsxs("span",{children:[h.jsx("kbd",{children:"↵"})," open"]}),h.jsxs("span",{children:[h.jsx("kbd",{children:"esc"})," close"]}),W?h.jsxs("button",{type:"button",className:"btn-ghost command-palette-footer-cta","data-testid":"command-palette-destination",onClick:()=>{if(W.href)window.open(W.href,"_blank","noopener,noreferrer");else if(W.actionId){const P=f.find(D=>D.id===W.actionId);P&&(P.run(),w())}},children:[W.label,h.jsx(de,{name:W.href?"ExternalLink":"ArrowRight",size:14})]}):h.jsxs("span",{className:"command-palette-footer-mod",children:[h.jsx("kbd",{children:S5}),h.jsx("kbd",{children:"K"})," anytime"]})]})]})})}const x5={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 C5({status:e,onRetry:t,retrying:i=!1,detail:r,onStartAuth:o}){const c=x5[e],[f,l]=z.useState({status:"idle"}),d=async()=>{if(o){l({status:"pending"});try{await o(),l({status:"idle"})}catch(m){const y=m instanceof Error?m.message:"Could not start sign-in. Try again.";l({status:"error",message:y})}}};return h.jsx("div",{className:"app-status connectivity-screen","data-testid":"connectivity-screen","data-status":e,role:"alert",children:h.jsxs("div",{className:"connectivity-screen-inner",children:[h.jsx("span",{className:"connectivity-screen-icon","aria-hidden":"true",children:h.jsx(de,{name:c.icon,size:22})}),h.jsx("span",{className:"connectivity-screen-title",children:c.title}),h.jsx("span",{className:"connectivity-screen-body",children:c.body}),e==="error"&&r&&h.jsx("span",{className:"connectivity-screen-detail","data-testid":"connectivity-screen-detail",children:r}),h.jsx("button",{className:"btn-primary connectivity-screen-retry","data-testid":"connectivity-retry",onClick:t,disabled:i||f.status==="pending",children:i?"Reconnecting…":"Retry"}),e==="auth"&&o&&h.jsxs("div",{className:"connectivity-screen-auth-section",children:[f.status==="pending"?h.jsxs("span",{className:"connectivity-auth-pending","data-testid":"connectivity-auth-pending",children:[h.jsx(de,{name:"Loader",size:14}),"Opening browser… waiting for sign-in"]}):h.jsxs("button",{className:"btn-secondary connectivity-connect-btn","data-testid":"connectivity-connect-btn",onClick:()=>void d(),children:[h.jsx(de,{name:"Plug",size:14}),"Connect account"]}),f.status==="error"&&h.jsx("span",{className:"connectivity-auth-error","data-testid":"connectivity-auth-error",children:f.message})]})]})})}function E5({onDismiss:e}){return h.jsxs("div",{className:"connectivity-banner",role:"status","data-testid":"connectivity-banner",children:[h.jsx("span",{className:"connectivity-banner-icon","aria-hidden":"true",children:h.jsx(de,{name:"CloudOff",size:14})}),h.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&&h.jsx("button",{className:"connectivity-banner-dismiss","aria-label":"Dismiss offline notice","data-testid":"connectivity-banner-dismiss",onClick:e,children:"×"})]})}function k5(e,t,i){const r=new Map;for(const o of t)r.has(o.agentSessionId)||r.set(o.agentSessionId,o);for(const o of e)i.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 A5=12;function ZC(e,t,i){var c;const r=[],o=f=>{f&&!r.includes(f)&&r.push(f)};return o((c=e.find(f=>f.id===i))==null?void 0:c.cwd),e.forEach(f=>o(f.cwd)),t.forEach(f=>o(f)),r.slice(0,A5)}const ca={"claude-code":"Claude Code",codex:"Codex"};function QC(e,t=Date.now()){const i=t-new Date(e).getTime(),r=Math.floor(i/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 j5(e,t){const i=new Date(t).getTime()-new Date(e).getTime();if(!Number.isFinite(i)||i<=0)return null;const r=Math.floor(i/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 z1(e){return e.resumeMode===void 0?"checking":e.resumeMode==="agent-resume"?"resume":(e.turnCount??e.messageCount??0)>0?"from-summary":"empty"}function R5(e){switch(e){case"resume":return null;case"from-summary":return"from summary";case"empty":return"nothing recorded";case"checking":return"checking…"}}function $v(e,t=Date.now(),i={}){const r=[];i.includeHarness!==!1&&r.push(ca[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=i.state?R5(i.state):null;return c&&r.push(c),r.push(QC(e.lastActiveAt,t)),r.join(" · ")}function e2(e,t){const[i,r]=z.useState(e===null?{status:"empty"}:{status:"loading"});return z.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]),i}function t2({text:e}){const t=e.split(`
470
+ `),i=[];let r=0,o=0;function c(){return o++}function f(l){const d=[],m=/(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*)/g;let y=0,v;for(;(v=m.exec(l))!==null;){v.index>y&&d.push(l.slice(y,v.index));const S=v[0];S.startsWith("`")&&S.endsWith("`")?d.push(h.jsx("code",{className:"chat-inline-code",children:S.slice(1,-1)},c())):S.startsWith("**")&&S.endsWith("**")?d.push(h.jsx("strong",{children:S.slice(2,-2)},c())):S.startsWith("*")&&S.endsWith("*")?d.push(h.jsx("em",{children:S.slice(1,-1)},c())):d.push(S),y=v.index+S.length}return y<l.length&&d.push(l.slice(y)),d}for(;r<t.length;){const l=t[r];if(l.startsWith("```")){const v=l.slice(3).trim(),S=[];for(r++;r<t.length&&!t[r].startsWith("```");)S.push(t[r]),r++;r++,i.push(h.jsx("pre",{className:"chat-code-block","data-lang":v||void 0,children:h.jsx("code",{className:v?`language-${v}`:void 0,children:S.join(`
471
+ `)})},c()));continue}const d=l.match(/^(#{1,3})\s+(.+)/);if(d){const S=`h${d[1].length}`;i.push(h.jsx(S,{className:"chat-heading",children:f(d[2])},c())),r++;continue}if(l.startsWith("> ")){i.push(h.jsx("blockquote",{className:"chat-blockquote",children:f(l.slice(2))},c())),r++;continue}if(/^- \[[ x]\]/.test(l)){const v=[];for(;r<t.length&&/^- \[[ x]\]/.test(t[r]);){const S=t[r][3]==="x";v.push({text:t[r].replace(/^- \[[ x]\]\s?/,""),checked:S}),r++}i.push(h.jsx("ul",{className:"chat-list chat-checklist",children:v.map((S,w)=>h.jsx("li",{children:f(S.text)},w))},c()));continue}if(/^[-*+]\s+/.test(l)){const v=[];for(;r<t.length&&/^[-*+]\s+/.test(t[r]);){const S=t[r].replace(/^[-*+]\s+/,"");v.push(h.jsx("li",{children:f(S)},c())),r++}i.push(h.jsx("ul",{className:"chat-list",children:v},c()));continue}if(!l.trim()){r++;continue}const m=v=>v.startsWith("```")||/^#{1,3}\s+/.test(v)||v.startsWith("> ")||/^[-*+]\s+/.test(v),y=[l];for(r++;r<t.length&&t[r].trim()&&!m(t[r]);)y.push(t[r]),r++;i.push(h.jsx("p",{className:"chat-paragraph",children:f(y.join(" "))},c()))}return h.jsx(h.Fragment,{children:i})}const U1={"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."},T5=["assistant-narration-gap","truncated-tool-output","missing-assistant-text","incomplete-final-turn","compacted-archive","dropped-early-turns"];function N5(e){const t=new Set(e),i=T5.filter(o=>t.has(o)).map(o=>U1[o]),r=[...t].filter(o=>!(o in U1)).map(o=>`Known gap reported by the harness: ${o}.`);return[...i,...r]}function M5(e){if(!e)return null;const t=[];return e.inputTokens!=null&&t.push(`${q1(e.inputTokens)} in`),e.outputTokens!=null&&t.push(`${q1(e.outputTokens)} out`),t.length>0?t.join(" · "):null}function q1(e){if(e<1e3)return String(e);const t=e/1e3;return`${t<100?t.toFixed(1):Math.round(t)}k`}function s2(e,t=Date.now()){if(!e)return null;const i=new Date(e);if(Number.isNaN(i.getTime()))return null;const r=i.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),o=new Date(t);return i.getFullYear()===o.getFullYear()&&i.getMonth()===o.getMonth()&&i.getDate()===o.getDate()?r:`${i.toLocaleDateString([],{day:"numeric",month:"short"})}, ${r}`}function D5(e,t){const i=e??"unknown tool";if(!t)return i;const r=t.replace(/\s+/g," ").trim();if(!r)return i;const o=r.length>80?`${r.slice(0,80)}…`:r;return`${i} · ${o}`}function O5({record:e}){const t=N5(e.limitations),i=s2(e.archivedAt);return h.jsxs("div",{className:"transcript","data-testid":"session-transcript",children:[h.jsxs("div",{className:"transcript-notice","data-testid":"transcript-reconstructed",children:[h.jsx("span",{className:"transcript-badge",children:"Reconstructed"}),h.jsxs("div",{className:"transcript-notice-body",children:[h.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&&h.jsx("p",{className:"transcript-notice-lead transcript-notice-archived","data-testid":"transcript-archived",children:i?`Archived copy from ${i}, 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&&h.jsx("ul",{className:"transcript-notice-list","data-testid":"transcript-limitations",children:t.map(r=>h.jsx("li",{children:r},r))})]})]}),h.jsx("ol",{className:"transcript-turns",children:e.turns.map(r=>h.jsx($5,{turn:r},r.index))})]})}function $5({turn:e}){const t=M5(e.usage),i=s2(e.promptAt);return h.jsxs("li",{className:"transcript-turn","data-testid":"transcript-turn","data-turn":e.index,children:[h.jsxs("div",{className:"transcript-role transcript-role-user",children:[h.jsx("span",{className:"transcript-role-label",children:"You"}),i&&h.jsx("span",{className:"transcript-time",children:i})]}),e.prompt!==null?h.jsx("div",{className:"transcript-prompt","data-testid":"transcript-prompt",children:e.prompt}):h.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&&h.jsx("ul",{className:"transcript-tools","data-testid":"transcript-tools",children:e.toolCalls.map((r,o)=>h.jsx(L5,{call:r},`${r.at}-${o}`))}),h.jsxs("div",{className:"transcript-role transcript-role-agent",children:[h.jsx("span",{className:"transcript-role-label",children:"Agent"}),e.model&&h.jsx("span",{className:"transcript-model",children:e.model}),t&&h.jsx("span",{className:"transcript-usage",children:t})]}),e.assistantText!==null?h.jsx("div",{className:"transcript-assistant","data-testid":"transcript-assistant",children:h.jsx(t2,{text:e.assistantText})}):h.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&&h.jsx("div",{className:"transcript-incomplete","data-testid":"transcript-incomplete",children:"Turn incomplete"})]})}function L5({call:e}){return h.jsx("li",{className:"transcript-tool",children:h.jsxs("details",{"data-testid":"transcript-tool-call",children:[h.jsxs("summary",{className:"transcript-tool-summary",children:[h.jsx("span",{className:"transcript-tool-name",children:D5(e.name,e.input)}),e.responseTruncated&&h.jsx("span",{className:"transcript-tool-truncated","data-testid":"transcript-tool-truncated",children:"truncated"})]}),h.jsxs("div",{className:"transcript-tool-body",children:[e.input&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"transcript-tool-heading",children:"Input"}),h.jsx("pre",{className:"transcript-tool-pre",children:e.input})]}),h.jsx("div",{className:"transcript-tool-heading",children:"Result"}),e.responseSummary?h.jsx("pre",{className:"transcript-tool-pre",children:e.responseSummary}):h.jsx("div",{className:"transcript-absent",children:"No result recorded."}),e.responseTruncated&&h.jsx("div",{className:"transcript-absent",children:"The recorded result was truncated at the collector's size cap; the rest isn't recoverable."})]})]})})}function F1(e){return e.agentSessionId==null?"This session can't be resumed: it exited before establishing a session id.":`${ca[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 I5({session:e,resumeMode:t,loadRecord:i,onResume:r,onContinue:o,onClose:c}){const f=e.agentSessionId!=null&&t!=="rehydrate",l=j5(e.createdAt,e.lastActiveAt),d=e2(e.id,i),m=d.status!=="empty",y=!f&&d.status==="ready";return h.jsxs("div",{className:"dead-session-pane","data-testid":"dead-session-pane","data-has-record":m,...$t({surface:"session_history"}),children:[h.jsxs("div",{className:"dead-session-summary",...$t({object:"session"}),children:[h.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:h.jsx(de,{name:"SquareTerminal",size:18})}),h.jsx("div",{className:"dead-session-title",children:"Session exited"}),h.jsxs("div",{className:"dead-session-meta",children:[e.cwd,e.exitCode!=null&&` · exit code ${e.exitCode}`]}),h.jsxs("dl",{className:"dead-session-detail","data-testid":"dead-session-detail",children:[e.title&&h.jsxs("div",{className:"dead-session-detail-row",children:[h.jsx("dt",{children:"Session"}),h.jsx("dd",{children:e.title})]}),h.jsxs("div",{className:"dead-session-detail-row",children:[h.jsx("dt",{children:"Coding agent"}),h.jsx("dd",{children:ca[e.harness]})]}),l&&h.jsxs("div",{className:"dead-session-detail-row",children:[h.jsx("dt",{children:"Ran for"}),h.jsx("dd",{children:l})]}),h.jsxs("div",{className:"dead-session-detail-row",children:[h.jsx("dt",{children:"Ended"}),h.jsx("dd",{children:QC(e.lastActiveAt)})]})]}),h.jsxs("div",{className:"dead-session-actions",children:[y?h.jsx("button",{className:"btn-primary","data-testid":"dead-session-continue",onClick:o,children:"Continue here"}):h.jsx("button",{className:"btn-primary","data-testid":"dead-session-resume",onClick:r,disabled:!f,title:f?void 0:F1(e),children:"Resume"}),h.jsx("button",{className:"btn-ghost","data-testid":"dead-session-close",onClick:c,children:"Close"})]}),!f&&h.jsxs("div",{className:"dead-session-resume-reason","data-testid":"dead-session-resume-reason",children:[F1(e)," ",y?"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&&h.jsxs("div",{className:"dead-session-exit-tail","data-testid":"dead-session-exit-tail",children:[h.jsx("div",{className:"dead-session-exit-tail-label",children:"Last output before exit"}),h.jsx("pre",{className:"dead-session-exit-tail-body",children:e.exitTail})]}),m&&h.jsx("div",{className:"dead-session-record","data-testid":"dead-session-record",children:h.jsx(i2,{state:d})})]})}function P5({summary:e,loadRecord:t,onStart:i,onClose:r}){const o=e.resumeMode==="agent-resume",c=e.harnessSessionId??e.agentSessionId,f=e2(c,t),l=!o&&f.status==="ready";return h.jsxs("div",{className:"past-session-pane","data-testid":"past-session-pane",children:[h.jsxs("header",{className:"past-session-header",children:[h.jsxs("div",{className:"past-session-heading",children:[h.jsx("div",{className:"dead-session-title",children:e.title}),h.jsxs("div",{className:"dead-session-meta",children:[$v(e)," · ",e.cwd]})]}),h.jsxs("div",{className:"dead-session-actions",children:[h.jsx("button",{className:"btn-primary","data-testid":"past-session-start",onClick:i,children:o?"Resume":l?"Continue here":"New session here"}),h.jsx("button",{className:"btn-ghost","data-testid":"past-session-close",onClick:r,children:"Close"})]})]}),!o&&h.jsxs("div",{className:"dead-session-resume-reason","data-testid":"past-session-reason",children:[ca[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."]}),h.jsx("div",{className:"past-session-body",children:h.jsx(i2,{state:f})})]})}function i2({state:e}){return e.status==="loading"?h.jsx("div",{className:"past-session-status","data-testid":"past-session-loading",children:"Rebuilding this session's transcript…"}):e.status==="error"?h.jsxs("div",{className:"past-session-status","data-testid":"past-session-error",children:["Couldn't load this session's transcript: ",e.message]}):e.status==="empty"?h.jsxs("div",{className:"past-session-status","data-testid":"past-session-empty",children:[h.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:h.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."]}):h.jsx(O5,{record:e.record})}function B5({onCancel:e,onConfirm:t,triggerRef:i}){const r=z.useRef(null);return xo(!0,{onDismiss:e,containerRef:r,triggerRef:i}),h.jsx("div",{className:"modal-backdrop",onClick:e,children:h.jsxs("div",{ref:r,className:"modal modal-confirm",role:"alertdialog","aria-label":"End session","data-testid":"end-session-confirm",onClick:o=>o.stopPropagation(),children:[h.jsxs("div",{className:"modal-header",children:["End session?",h.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:e,children:h.jsx(de,{name:"X",size:14})})]}),h.jsx("div",{className:"modal-body",children:h.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."})}),h.jsxs("div",{className:"modal-actions",children:[h.jsx("button",{className:"btn-ghost",autoFocus:!0,onClick:e,children:"Keep session"}),h.jsx("button",{className:"btn-danger","data-testid":"end-session-confirm-btn",onClick:t,children:"End session"})]})]})})}function H5({sessions:e,activeSessionId:t,busySessionIds:i,labelOf:r,subjectName:o,onSelect:c,onNew:f,newSessionPending:l,menuOpen:d,onToggleMenu:m,menuTriggerRef:y,menuTooltip:v,renaming:S,renameDraft:w,onRenameDraftChange:R,onCommitRename:x,onCancelRename:g}){const b=z.useRef(null),p=z.useRef(!1);return z.useEffect(()=>{var _;(_=b.current)==null||_.scrollIntoView({block:"nearest",inline:"nearest"})},[t,e.length]),h.jsxs("div",{className:"session-tabs","data-testid":"session-tabs",children:[h.jsx("div",{className:"session-tabs-list",role:"tablist","aria-label":"Sessions",children:e.map(_=>{const k=_.id===t,A=r(_),C=ca[_.harness],N=k&&S;return h.jsxs("div",{ref:k?b:void 0,className:`session-tab${k?" is-active":""}`,"data-testid":`session-tab-${_.id}`,children:[N?h.jsx("input",{className:"group-name-input session-rename-input session-tab-rename","data-testid":"session-rename-input","aria-label":"Rename session",value:w,autoFocus:!0,onFocus:j=>{p.current=!1,j.currentTarget.select()},onChange:j=>R(j.target.value),onKeyDown:j=>{j.key==="Enter"&&x(),j.key==="Escape"&&(p.current=!0,g())},onBlur:()=>{if(p.current){p.current=!1;return}x()}}):h.jsxs("button",{type:"button",role:"tab","aria-selected":k,className:"session-tab-main","data-testid":`session-tab-main-${_.id}`,title:`${A} · ${C}`,"data-tooltip":`${A} · ${C}`,onClick:()=>c(_.id),children:[i.has(_.id)?h.jsx("span",{className:"session-busy","data-testid":`session-tab-busy-${_.id}`,"aria-hidden":"true"}):h.jsx("span",{className:"session-dot","data-status":_.status,"aria-hidden":"true"}),h.jsx("span",{className:"session-tab-label","data-testid":k?"session-context-title":void 0,children:A})]}),k&&!N&&h.jsx("button",{ref:y,type:"button",className:"theme-toggle session-tab-menu","data-testid":"session-menu","aria-label":"Session options","aria-haspopup":"menu","aria-expanded":d,"data-tooltip":v,onClick:j=>{j.stopPropagation(),m()},...$t({object:"session"}),children:h.jsx(de,{name:"ChevronDown",size:12})})]},_.id)})}),h.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:f,children:l?h.jsx("span",{className:"session-busy","aria-hidden":"true"}):h.jsx(de,{name:"Plus",size:14})})]})}function Ml(e){return Gn(e)}const z5=new Set;function U5({overviewMode:e=!1,openedAgentName:t=null,reviewTitle:i=null,composing:r=!1,onBack:o=null,activeSession:c,sessionName:f,onRenameSession:l,boundWorkflowName:d,busy:m,onExpandRail:y,onExpandRight:v,onCloseSession:S,onOpenInEditor:w,editorLabel:R,onToast:x,actions:g=null,onNewSession:b=null,newSessionPending:p=!1,subjectName:_=null,sessions:k=[],busySessionIds:A=z5,onSelectSession:C=null,labelOf:N}){const[j,M]=z.useState(!1),[O,B]=z.useState(!1),[q,V]=z.useState(!1),[J,ee]=z.useState(""),W=z.useRef(null),Q=()=>B(!1),ie=()=>{c&&l(c.id,J),V(!1)};return z.useEffect(()=>{B(!1),V(!1),M(!1)},[c==null?void 0:c.id]),h.jsxs("div",{className:"session-bar",...$t({surface:"session_bar"}),children:[y&&h.jsx("button",{className:"theme-toggle rail-toggle","data-testid":"rail-expand","aria-label":"Expand workspace panel",title:"Expand workspace panel",onClick:y,children:h.jsx(de,{name:"PanelLeftOpen",size:14})}),h.jsx("div",{className:"session-queue","data-testid":"session-context","data-session-id":(c==null?void 0:c.id)??"",children:e?h.jsxs("div",{className:"session-current session-current-static",children:[h.jsx(de,{name:"Radio",size:13}),h.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:"Overview"})]}):t?h.jsxs("div",{className:"session-current session-current-static",children:[h.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:t}),h.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"})]}):i?h.jsxs("div",{className:"session-current session-current-static",children:[h.jsx(de,{name:"History",size:13}),h.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:i}),h.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:[h.jsx("span",{className:"session-dot","data-status":"exited"}),"past"]})]}):r?o?h.jsxs("button",{type:"button",className:"session-current session-back","data-testid":"composer-back",onClick:o,children:[h.jsx(de,{name:"ArrowLeft",size:13}),h.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:"Back"})]}):null:c&&c.status!=="exited"&&k.length>0&&C&&b&&N?h.jsx(H5,{sessions:k,activeSessionId:c.id,busySessionIds:A,labelOf:N,subjectName:_??Ml(c.cwd),onSelect:C,onNew:b,newSessionPending:p,menuOpen:O,onToggleMenu:()=>B(I=>!I),menuTriggerRef:W,menuTooltip:`${ca[c.harness]} · ${Ml(c.cwd)} · ${c.cwd}`,renaming:q,renameDraft:J,onRenameDraftChange:ee,onCommitRename:ie,onCancelRename:()=>V(!1)}):c?h.jsx("div",{className:"session-current-wrap",children:q?h.jsx("input",{className:"group-name-input session-rename-input session-context-rename","data-testid":"session-rename-input",value:J,autoFocus:!0,onFocus:I=>I.currentTarget.select(),onChange:I=>ee(I.target.value),onKeyDown:I=>{I.key==="Enter"&&ie(),I.key==="Escape"&&V(!1)},onBlur:ie}):h.jsxs("button",{ref:W,type:"button",className:"session-current session-title-trigger","data-testid":"session-menu","aria-haspopup":"menu","aria-expanded":O,"data-tooltip":`${ca[c.harness]} · ${Ml(c.cwd)} · ${c.cwd}`,onClick:()=>B(I=>!I),...$t({object:"session"}),children:[m?h.jsx("span",{className:"session-busy","data-testid":"session-busy","aria-hidden":"true"}):h.jsx("span",{className:"session-dot","data-status":c.status,"aria-hidden":"true"}),h.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:N?N(c):f??c.title}),h.jsx(de,{name:"ChevronDown",size:13})]})}):h.jsx("span",{className:"session-context-none",children:"No active session"})}),c&&h.jsxs(fn,{open:O,anchorRef:W,onDismiss:Q,placement:"down-start",className:"session-menu",role:"menu",testid:"session-menu-popover",children:[d&&h.jsxs("div",{className:"session-menu-bound","data-testid":"session-workflow-chip",children:["Bound to ",h.jsx("strong",{children:d})," · shown in Canvas"]}),h.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{var I;(I=navigator.clipboard)==null||I.writeText(c.cwd).then(()=>x("Path copied.","success")).catch(()=>x("Couldn't copy the path.")),Q()},children:[h.jsx(de,{name:"Copy",size:13}),"Copy path"]}),h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"session-rename",onClick:()=>{ee(f??c.title),V(!0),Q()},children:[h.jsx(de,{name:"Pencil",size:13}),"Rename session"]}),h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"session-open-editor",onClick:()=>{w(c.cwd),Q()},children:[h.jsx(de,{name:"Code",size:13}),"Open in ",R]}),c.status!=="exited"&&h.jsxs("button",{role:"menuitem",className:"profile-menu-item session-menu-danger","data-testid":"session-end-btn",onClick:()=>{Q(),M(!0)},children:[h.jsx(de,{name:"X",size:13}),"End session…"]})]}),b&&(c==null?void 0:c.status)==="exited"&&!r&&h.jsx("button",{type:"button",className:"theme-toggle session-tab-new","data-testid":"session-tab-new","aria-label":`New session on ${_??Ml(c.cwd)}`,"aria-busy":p,"data-tooltip":`New session on ${_??Ml(c.cwd)}`,disabled:p,onClick:b,children:p?h.jsx("span",{className:"session-busy","aria-hidden":"true"}):h.jsx(de,{name:"Plus",size:14})}),g,v&&h.jsx("button",{className:"theme-toggle","data-testid":"right-expand","aria-label":"Expand canvas panel",title:"Expand canvas panel",onClick:v,children:h.jsx(de,{name:"PanelRightOpen",size:15})}),j&&c&&h.jsx(B5,{triggerRef:W,onCancel:()=>M(!1),onConfirm:()=>{M(!1),S(c.id)}})]})}const V1={deploy:"deploy",prod_run:"prod-run",run_local:"run-local"};function n2(e){return Object.prototype.hasOwnProperty.call(V1,e)?V1[e]:null}function q5(e){return n2(e.id)===null&&e.action.kind==="inject"}function F5(e,t,i){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"&&!i?"Start a session first":null}function V5(e,t){return e.replace("{{workflow.definitionId}}",String((t==null?void 0:t.definitionId)??""))}var Du={exports:{}},Cm={},Ln={},Jr={},Em={},km={},Am={},W1;function gh(){return W1||(W1=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 i extends t{constructor(p){if(super(),!e.IDENTIFIER.test(p))throw new Error("CodeGen: name must be a valid identifier");this.str=p}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=i;class r extends t{constructor(p){super(),this._items=typeof p=="string"?[p]:p}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const p=this._items[0];return p===""||p==='""'}get str(){var p;return(p=this._str)!==null&&p!==void 0?p:this._str=this._items.reduce((_,k)=>`${_}${k}`,"")}get names(){var p;return(p=this._names)!==null&&p!==void 0?p:this._names=this._items.reduce((_,k)=>(k instanceof i&&(_[k.str]=(_[k.str]||0)+1),_),{})}}e._Code=r,e.nil=new r("");function o(b,...p){const _=[b[0]];let k=0;for(;k<p.length;)l(_,p[k]),_.push(b[++k]);return new r(_)}e._=o;const c=new r("+");function f(b,...p){const _=[w(b[0])];let k=0;for(;k<p.length;)_.push(c),l(_,p[k]),_.push(c,w(b[++k]));return d(_),new r(_)}e.str=f;function l(b,p){p instanceof r?b.push(...p._items):p instanceof i?b.push(p):b.push(v(p))}e.addCodeArg=l;function d(b){let p=1;for(;p<b.length-1;){if(b[p]===c){const _=m(b[p-1],b[p+1]);if(_!==void 0){b.splice(p-1,3,_);continue}b[p++]="+"}p++}}function m(b,p){if(p==='""')return b;if(b==='""')return p;if(typeof b=="string")return p instanceof i||b[b.length-1]!=='"'?void 0:typeof p!="string"?`${b.slice(0,-1)}${p}"`:p[0]==='"'?b.slice(0,-1)+p.slice(1):void 0;if(typeof p=="string"&&p[0]==='"'&&!(b instanceof i))return`"${b}${p.slice(1)}`}function y(b,p){return p.emptyStr()?b:b.emptyStr()?p:f`${b}${p}`}e.strConcat=y;function v(b){return typeof b=="number"||typeof b=="boolean"||b===null?b:w(Array.isArray(b)?b.join(","):b)}function S(b){return new r(w(b))}e.stringify=S;function w(b){return JSON.stringify(b).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=w;function R(b){return typeof b=="string"&&e.IDENTIFIER.test(b)?new r(`.${b}`):o`[${b}]`}e.getProperty=R;function x(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=x;function g(b){return new r(b.toString())}e.regexpCode=g})(Am)),Am}var jm={},G1;function K1(){return G1||(G1=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=gh();class i extends Error{constructor(m){super(`CodeGen: "code" for ${m} not defined`),this.value=m.value}}var r;(function(d){d[d.Started=0]="Started",d[d.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:y}={}){this._names={},this._prefixes=m,this._parent=y}toName(m){return m instanceof t.Name?m:this.name(m)}name(m){return new t.Name(this._newName(m))}_newName(m){const y=this._names[m]||this._nameGroup(m);return`${m}${y.index++}`}_nameGroup(m){var y,v;if(!((v=(y=this._parent)===null||y===void 0?void 0:y._prefixes)===null||v===void 0)&&v.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,y){super(y),this.prefix=m}setValue(m,{property:y,itemIndex:v}){this.value=m,this.scopePath=(0,t._)`.${new t.Name(y)}[${v}]`}}e.ValueScopeName=c;const f=(0,t._)`\n`;class l extends o{constructor(m){super(m),this._values={},this._scope=m.scope,this.opts={...m,_n:m.lines?f:t.nil}}get(){return this._scope}name(m){return new c(m,this._newName(m))}value(m,y){var v;if(y.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const S=this.toName(m),{prefix:w}=S,R=(v=y.key)!==null&&v!==void 0?v:y.ref;let x=this._values[w];if(x){const p=x.get(R);if(p)return p}else x=this._values[w]=new Map;x.set(R,S);const g=this._scope[w]||(this._scope[w]=[]),b=g.length;return g[b]=y.ref,S.setValue(y,{property:w,itemIndex:b}),S}getValue(m,y){const v=this._values[m];if(v)return v.get(y)}scopeRefs(m,y=this._values){return this._reduceValues(y,v=>{if(v.scopePath===void 0)throw new Error(`CodeGen: name "${v}" has no value`);return(0,t._)`${m}${v.scopePath}`})}scopeCode(m=this._values,y,v){return this._reduceValues(m,S=>{if(S.value===void 0)throw new Error(`CodeGen: name "${S}" has no value`);return S.value.code},y,v)}_reduceValues(m,y,v={},S){let w=t.nil;for(const R in m){const x=m[R];if(!x)continue;const g=v[R]=v[R]||new Map;x.forEach(b=>{if(g.has(b))return;g.set(b,r.Started);let p=y(b);if(p){const _=this.opts.es5?e.varKinds.var:e.varKinds.const;w=(0,t._)`${w}${_} ${b} = ${p};${this.opts._n}`}else if(p=S==null?void 0:S(b))w=(0,t._)`${w}${p}${this.opts._n}`;else throw new i(b);g.set(b,r.Completed)})}return w}}e.ValueScope=l})(jm)),jm}var Y1;function ft(){return Y1||(Y1=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=gh(),i=K1();var r=gh();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=K1();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(L,G){return this}}class f extends c{constructor(L,G,se){super(),this.varKind=L,this.name=G,this.rhs=se}render({es5:L,_n:G}){const se=L?i.varKinds.var:this.varKind,Y=this.rhs===void 0?"":` = ${this.rhs}`;return`${se} ${this.name}${Y};`+G}optimizeNames(L,G){if(L[this.name.str])return this.rhs&&(this.rhs=J(this.rhs,L,G)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class l extends c{constructor(L,G,se){super(),this.lhs=L,this.rhs=G,this.sideEffects=se}render({_n:L}){return`${this.lhs} = ${this.rhs};`+L}optimizeNames(L,G){if(!(this.lhs instanceof t.Name&&!L[this.lhs.str]&&!this.sideEffects))return this.rhs=J(this.rhs,L,G),this}get names(){const L=this.lhs instanceof t.Name?{}:{...this.lhs.names};return V(L,this.rhs)}}class d extends l{constructor(L,G,se,Y){super(L,se,Y),this.op=G}render({_n:L}){return`${this.lhs} ${this.op}= ${this.rhs};`+L}}class m extends c{constructor(L){super(),this.label=L,this.names={}}render({_n:L}){return`${this.label}:`+L}}class y extends c{constructor(L){super(),this.label=L,this.names={}}render({_n:L}){return`break${this.label?` ${this.label}`:""};`+L}}class v extends c{constructor(L){super(),this.error=L}render({_n:L}){return`throw ${this.error};`+L}get names(){return this.error.names}}class S extends c{constructor(L){super(),this.code=L}render({_n:L}){return`${this.code};`+L}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(L,G){return this.code=J(this.code,L,G),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class w extends c{constructor(L=[]){super(),this.nodes=L}render(L){return this.nodes.reduce((G,se)=>G+se.render(L),"")}optimizeNodes(){const{nodes:L}=this;let G=L.length;for(;G--;){const se=L[G].optimizeNodes();Array.isArray(se)?L.splice(G,1,...se):se?L[G]=se:L.splice(G,1)}return L.length>0?this:void 0}optimizeNames(L,G){const{nodes:se}=this;let Y=se.length;for(;Y--;){const F=se[Y];F.optimizeNames(L,G)||(ee(L,F.names),se.splice(Y,1))}return se.length>0?this:void 0}get names(){return this.nodes.reduce((L,G)=>q(L,G.names),{})}}class R extends w{render(L){return"{"+L._n+super.render(L)+"}"+L._n}}class x extends w{}class g extends R{}g.kind="else";class b extends R{constructor(L,G){super(G),this.condition=L}render(L){let G=`if(${this.condition})`+super.render(L);return this.else&&(G+="else "+this.else.render(L)),G}optimizeNodes(){super.optimizeNodes();const L=this.condition;if(L===!0)return this.nodes;let G=this.else;if(G){const se=G.optimizeNodes();G=this.else=Array.isArray(se)?new g(se):se}if(G)return L===!1?G instanceof b?G:G.nodes:this.nodes.length?this:new b(W(L),G instanceof b?[G]:G.nodes);if(!(L===!1||!this.nodes.length))return this}optimizeNames(L,G){var se;if(this.else=(se=this.else)===null||se===void 0?void 0:se.optimizeNames(L,G),!!(super.optimizeNames(L,G)||this.else))return this.condition=J(this.condition,L,G),this}get names(){const L=super.names;return V(L,this.condition),this.else&&q(L,this.else.names),L}}b.kind="if";class p extends R{}p.kind="for";class _ extends p{constructor(L){super(),this.iteration=L}render(L){return`for(${this.iteration})`+super.render(L)}optimizeNames(L,G){if(super.optimizeNames(L,G))return this.iteration=J(this.iteration,L,G),this}get names(){return q(super.names,this.iteration.names)}}class k extends p{constructor(L,G,se,Y){super(),this.varKind=L,this.name=G,this.from=se,this.to=Y}render(L){const G=L.es5?i.varKinds.var:this.varKind,{name:se,from:Y,to:F}=this;return`for(${G} ${se}=${Y}; ${se}<${F}; ${se}++)`+super.render(L)}get names(){const L=V(super.names,this.from);return V(L,this.to)}}class A extends p{constructor(L,G,se,Y){super(),this.loop=L,this.varKind=G,this.name=se,this.iterable=Y}render(L){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(L)}optimizeNames(L,G){if(super.optimizeNames(L,G))return this.iterable=J(this.iterable,L,G),this}get names(){return q(super.names,this.iterable.names)}}class C extends R{constructor(L,G,se){super(),this.name=L,this.args=G,this.async=se}render(L){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(L)}}C.kind="func";class N extends w{render(L){return"return "+super.render(L)}}N.kind="return";class j extends R{render(L){let G="try"+super.render(L);return this.catch&&(G+=this.catch.render(L)),this.finally&&(G+=this.finally.render(L)),G}optimizeNodes(){var L,G;return super.optimizeNodes(),(L=this.catch)===null||L===void 0||L.optimizeNodes(),(G=this.finally)===null||G===void 0||G.optimizeNodes(),this}optimizeNames(L,G){var se,Y;return super.optimizeNames(L,G),(se=this.catch)===null||se===void 0||se.optimizeNames(L,G),(Y=this.finally)===null||Y===void 0||Y.optimizeNames(L,G),this}get names(){const L=super.names;return this.catch&&q(L,this.catch.names),this.finally&&q(L,this.finally.names),L}}class M extends R{constructor(L){super(),this.error=L}render(L){return`catch(${this.error})`+super.render(L)}}M.kind="catch";class O extends R{render(L){return"finally"+super.render(L)}}O.kind="finally";class B{constructor(L,G={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...G,_n:G.lines?`
472
+ `:""},this._extScope=L,this._scope=new i.Scope({parent:L}),this._nodes=[new x]}toString(){return this._root.render(this.opts)}name(L){return this._scope.name(L)}scopeName(L){return this._extScope.name(L)}scopeValue(L,G){const se=this._extScope.value(L,G);return(this._values[se.prefix]||(this._values[se.prefix]=new Set)).add(se),se}getScopeValue(L,G){return this._extScope.getValue(L,G)}scopeRefs(L){return this._extScope.scopeRefs(L,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(L,G,se,Y){const F=this._scope.toName(G);return se!==void 0&&Y&&(this._constants[F.str]=se),this._leafNode(new f(L,F,se)),F}const(L,G,se){return this._def(i.varKinds.const,L,G,se)}let(L,G,se){return this._def(i.varKinds.let,L,G,se)}var(L,G,se){return this._def(i.varKinds.var,L,G,se)}assign(L,G,se){return this._leafNode(new l(L,G,se))}add(L,G){return this._leafNode(new d(L,e.operators.ADD,G))}code(L){return typeof L=="function"?L():L!==t.nil&&this._leafNode(new S(L)),this}object(...L){const G=["{"];for(const[se,Y]of L)G.length>1&&G.push(","),G.push(se),(se!==Y||this.opts.es5)&&(G.push(":"),(0,t.addCodeArg)(G,Y));return G.push("}"),new t._Code(G)}if(L,G,se){if(this._blockNode(new b(L)),G&&se)this.code(G).else().code(se).endIf();else if(G)this.code(G).endIf();else if(se)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(L){return this._elseNode(new b(L))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(b,g)}_for(L,G){return this._blockNode(L),G&&this.code(G).endFor(),this}for(L,G){return this._for(new _(L),G)}forRange(L,G,se,Y,F=this.opts.es5?i.varKinds.var:i.varKinds.let){const le=this._scope.toName(L);return this._for(new k(F,le,G,se),()=>Y(le))}forOf(L,G,se,Y=i.varKinds.const){const F=this._scope.toName(L);if(this.opts.es5){const le=G instanceof t.Name?G:this.var("_arr",G);return this.forRange("_i",0,(0,t._)`${le}.length`,ae=>{this.var(F,(0,t._)`${le}[${ae}]`),se(F)})}return this._for(new A("of",Y,F,G),()=>se(F))}forIn(L,G,se,Y=this.opts.es5?i.varKinds.var:i.varKinds.const){if(this.opts.ownProperties)return this.forOf(L,(0,t._)`Object.keys(${G})`,se);const F=this._scope.toName(L);return this._for(new A("in",Y,F,G),()=>se(F))}endFor(){return this._endBlockNode(p)}label(L){return this._leafNode(new m(L))}break(L){return this._leafNode(new y(L))}return(L){const G=new N;if(this._blockNode(G),this.code(L),G.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(N)}try(L,G,se){if(!G&&!se)throw new Error('CodeGen: "try" without "catch" and "finally"');const Y=new j;if(this._blockNode(Y),this.code(L),G){const F=this.name("e");this._currNode=Y.catch=new M(F),G(F)}return se&&(this._currNode=Y.finally=new O,this.code(se)),this._endBlockNode(M,O)}throw(L){return this._leafNode(new v(L))}block(L,G){return this._blockStarts.push(this._nodes.length),L&&this.code(L).endBlock(G),this}endBlock(L){const G=this._blockStarts.pop();if(G===void 0)throw new Error("CodeGen: not in self-balancing block");const se=this._nodes.length-G;if(se<0||L!==void 0&&se!==L)throw new Error(`CodeGen: wrong number of nodes: ${se} vs ${L} expected`);return this._nodes.length=G,this}func(L,G=t.nil,se,Y){return this._blockNode(new C(L,G,se)),Y&&this.code(Y).endFunc(),this}endFunc(){return this._endBlockNode(C)}optimize(L=1){for(;L-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(L){return this._currNode.nodes.push(L),this}_blockNode(L){this._currNode.nodes.push(L),this._nodes.push(L)}_endBlockNode(L,G){const se=this._currNode;if(se instanceof L||G&&se instanceof G)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${G?`${L.kind}/${G.kind}`:L.kind}"`)}_elseNode(L){const G=this._currNode;if(!(G instanceof b))throw new Error('CodeGen: "else" without "if"');return this._currNode=G.else=L,this}get _root(){return this._nodes[0]}get _currNode(){const L=this._nodes;return L[L.length-1]}set _currNode(L){const G=this._nodes;G[G.length-1]=L}}e.CodeGen=B;function q(U,L){for(const G in L)U[G]=(U[G]||0)+(L[G]||0);return U}function V(U,L){return L instanceof t._CodeOrName?q(U,L.names):U}function J(U,L,G){if(U instanceof t.Name)return se(U);if(!Y(U))return U;return new t._Code(U._items.reduce((F,le)=>(le instanceof t.Name&&(le=se(le)),le instanceof t._Code?F.push(...le._items):F.push(le),F),[]));function se(F){const le=G[F.str];return le===void 0||L[F.str]!==1?F:(delete L[F.str],le)}function Y(F){return F instanceof t._Code&&F._items.some(le=>le instanceof t.Name&&L[le.str]===1&&G[le.str]!==void 0)}}function ee(U,L){for(const G in L)U[G]=(U[G]||0)-(L[G]||0)}function W(U){return typeof U=="boolean"||typeof U=="number"||U===null?!U:(0,t._)`!${H(U)}`}e.not=W;const Q=D(e.operators.AND);function ie(...U){return U.reduce(Q)}e.and=ie;const I=D(e.operators.OR);function P(...U){return U.reduce(I)}e.or=P;function D(U){return(L,G)=>L===t.nil?G:G===t.nil?L:(0,t._)`${H(L)} ${U} ${H(G)}`}function H(U){return U instanceof t.Name?U:(0,t._)`(${U})`}})(km)),km}var vt={},X1;function yt(){if(X1)return vt;X1=1,Object.defineProperty(vt,"__esModule",{value:!0}),vt.checkStrictMode=vt.getErrorPath=vt.Type=vt.useFunc=vt.setEvaluated=vt.evaluatedPropsToName=vt.mergeEvaluated=vt.eachItem=vt.unescapeJsonPointer=vt.escapeJsonPointer=vt.escapeFragment=vt.unescapeFragment=vt.schemaRefOrVal=vt.schemaHasRulesButRef=vt.schemaHasRules=vt.checkUnknownRules=vt.alwaysValidSchema=vt.toHash=void 0;const e=ft(),t=gh();function i(A){const C={};for(const N of A)C[N]=!0;return C}vt.toHash=i;function r(A,C){return typeof C=="boolean"?C:Object.keys(C).length===0?!0:(o(A,C),!c(C,A.self.RULES.all))}vt.alwaysValidSchema=r;function o(A,C=A.schema){const{opts:N,self:j}=A;if(!N.strictSchema||typeof C=="boolean")return;const M=j.RULES.keywords;for(const O in C)M[O]||k(A,`unknown keyword: "${O}"`)}vt.checkUnknownRules=o;function c(A,C){if(typeof A=="boolean")return!A;for(const N in A)if(C[N])return!0;return!1}vt.schemaHasRules=c;function f(A,C){if(typeof A=="boolean")return!A;for(const N in A)if(N!=="$ref"&&C.all[N])return!0;return!1}vt.schemaHasRulesButRef=f;function l({topSchemaRef:A,schemaPath:C},N,j,M){if(!M){if(typeof N=="number"||typeof N=="boolean")return N;if(typeof N=="string")return(0,e._)`${N}`}return(0,e._)`${A}${C}${(0,e.getProperty)(j)}`}vt.schemaRefOrVal=l;function d(A){return v(decodeURIComponent(A))}vt.unescapeFragment=d;function m(A){return encodeURIComponent(y(A))}vt.escapeFragment=m;function y(A){return typeof A=="number"?`${A}`:A.replace(/~/g,"~0").replace(/\//g,"~1")}vt.escapeJsonPointer=y;function v(A){return A.replace(/~1/g,"/").replace(/~0/g,"~")}vt.unescapeJsonPointer=v;function S(A,C){if(Array.isArray(A))for(const N of A)C(N);else C(A)}vt.eachItem=S;function w({mergeNames:A,mergeToName:C,mergeValues:N,resultToName:j}){return(M,O,B,q)=>{const V=B===void 0?O:B instanceof e.Name?(O instanceof e.Name?A(M,O,B):C(M,O,B),B):O instanceof e.Name?(C(M,B,O),O):N(O,B);return q===e.Name&&!(V instanceof e.Name)?j(M,V):V}}vt.mergeEvaluated={props:w({mergeNames:(A,C,N)=>A.if((0,e._)`${N} !== true && ${C} !== undefined`,()=>{A.if((0,e._)`${C} === true`,()=>A.assign(N,!0),()=>A.assign(N,(0,e._)`${N} || {}`).code((0,e._)`Object.assign(${N}, ${C})`))}),mergeToName:(A,C,N)=>A.if((0,e._)`${N} !== true`,()=>{C===!0?A.assign(N,!0):(A.assign(N,(0,e._)`${N} || {}`),x(A,N,C))}),mergeValues:(A,C)=>A===!0?!0:{...A,...C},resultToName:R}),items:w({mergeNames:(A,C,N)=>A.if((0,e._)`${N} !== true && ${C} !== undefined`,()=>A.assign(N,(0,e._)`${C} === true ? true : ${N} > ${C} ? ${N} : ${C}`)),mergeToName:(A,C,N)=>A.if((0,e._)`${N} !== true`,()=>A.assign(N,C===!0?!0:(0,e._)`${N} > ${C} ? ${N} : ${C}`)),mergeValues:(A,C)=>A===!0?!0:Math.max(A,C),resultToName:(A,C)=>A.var("items",C)})};function R(A,C){if(C===!0)return A.var("props",!0);const N=A.var("props",(0,e._)`{}`);return C!==void 0&&x(A,N,C),N}vt.evaluatedPropsToName=R;function x(A,C,N){Object.keys(N).forEach(j=>A.assign((0,e._)`${C}${(0,e.getProperty)(j)}`,!0))}vt.setEvaluated=x;const g={};function b(A,C){return A.scopeValue("func",{ref:C,code:g[C.code]||(g[C.code]=new t._Code(C.code))})}vt.useFunc=b;var p;(function(A){A[A.Num=0]="Num",A[A.Str=1]="Str"})(p||(vt.Type=p={}));function _(A,C,N){if(A instanceof e.Name){const j=C===p.Num;return N?j?(0,e._)`"[" + ${A} + "]"`:(0,e._)`"['" + ${A} + "']"`:j?(0,e._)`"/" + ${A}`:(0,e._)`"/" + ${A}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return N?(0,e.getProperty)(A).toString():"/"+y(A)}vt.getErrorPath=_;function k(A,C,N=A.opts.strictSchema){if(N){if(C=`strict mode: ${C}`,N===!0)throw new Error(C);A.self.logger.warn(C)}}return vt.checkStrictMode=k,vt}var Ou={},J1;function en(){if(J1)return Ou;J1=1,Object.defineProperty(Ou,"__esModule",{value:!0});const e=ft(),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 Ou.default=t,Ou}var Z1;function jh(){return Z1||(Z1=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=ft(),i=yt(),r=en();e.keywordError={message:({keyword:g})=>(0,t.str)`must pass "${g}" keyword validation`},e.keyword$DataError={message:({keyword:g,schemaType:b})=>b?(0,t.str)`"${g}" keyword must be ${b} ($data)`:(0,t.str)`"${g}" keyword is invalid ($data)`};function o(g,b=e.keywordError,p,_){const{it:k}=g,{gen:A,compositeRule:C,allErrors:N}=k,j=v(g,b,p);_??(C||N)?d(A,j):m(k,(0,t._)`[${j}]`)}e.reportError=o;function c(g,b=e.keywordError,p){const{it:_}=g,{gen:k,compositeRule:A,allErrors:C}=_,N=v(g,b,p);d(k,N),A||C||m(_,r.default.vErrors)}e.reportExtraError=c;function f(g,b){g.assign(r.default.errors,b),g.if((0,t._)`${r.default.vErrors} !== null`,()=>g.if(b,()=>g.assign((0,t._)`${r.default.vErrors}.length`,b),()=>g.assign(r.default.vErrors,null)))}e.resetErrorsCount=f;function l({gen:g,keyword:b,schemaValue:p,data:_,errsCount:k,it:A}){if(k===void 0)throw new Error("ajv implementation error");const C=g.name("err");g.forRange("i",k,r.default.errors,N=>{g.const(C,(0,t._)`${r.default.vErrors}[${N}]`),g.if((0,t._)`${C}.instancePath === undefined`,()=>g.assign((0,t._)`${C}.instancePath`,(0,t.strConcat)(r.default.instancePath,A.errorPath))),g.assign((0,t._)`${C}.schemaPath`,(0,t.str)`${A.errSchemaPath}/${b}`),A.opts.verbose&&(g.assign((0,t._)`${C}.schema`,p),g.assign((0,t._)`${C}.data`,_))})}e.extendErrors=l;function d(g,b){const p=g.const("err",b);g.if((0,t._)`${r.default.vErrors} === null`,()=>g.assign(r.default.vErrors,(0,t._)`[${p}]`),(0,t._)`${r.default.vErrors}.push(${p})`),g.code((0,t._)`${r.default.errors}++`)}function m(g,b){const{gen:p,validateName:_,schemaEnv:k}=g;k.$async?p.throw((0,t._)`new ${g.ValidationError}(${b})`):(p.assign((0,t._)`${_}.errors`,b),p.return(!1))}const y={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 v(g,b,p){const{createErrors:_}=g.it;return _===!1?(0,t._)`{}`:S(g,b,p)}function S(g,b,p={}){const{gen:_,it:k}=g,A=[w(k,p),R(g,p)];return x(g,b,A),_.object(...A)}function w({errorPath:g},{instancePath:b}){const p=b?(0,t.str)`${g}${(0,i.getErrorPath)(b,i.Type.Str)}`:g;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,p)]}function R({keyword:g,it:{errSchemaPath:b}},{schemaPath:p,parentSchema:_}){let k=_?b:(0,t.str)`${b}/${g}`;return p&&(k=(0,t.str)`${k}${(0,i.getErrorPath)(p,i.Type.Str)}`),[y.schemaPath,k]}function x(g,{params:b,message:p},_){const{keyword:k,data:A,schemaValue:C,it:N}=g,{opts:j,propertyName:M,topSchemaRef:O,schemaPath:B}=N;_.push([y.keyword,k],[y.params,typeof b=="function"?b(g):b||(0,t._)`{}`]),j.messages&&_.push([y.message,typeof p=="function"?p(g):p]),j.verbose&&_.push([y.schema,C],[y.parentSchema,(0,t._)`${O}${B}`],[r.default.data,A]),M&&_.push([y.propertyName,M])}})(Em)),Em}var Q1;function W5(){if(Q1)return Jr;Q1=1,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.boolOrEmptySchema=Jr.topBoolOrEmptySchema=void 0;const e=jh(),t=ft(),i=en(),r={message:"boolean schema is false"};function o(l){const{gen:d,schema:m,validateName:y}=l;m===!1?f(l,!1):typeof m=="object"&&m.$async===!0?d.return(i.default.data):(d.assign((0,t._)`${y}.errors`,null),d.return(!0))}Jr.topBoolOrEmptySchema=o;function c(l,d){const{gen:m,schema:y}=l;y===!1?(m.var(d,!1),f(l)):m.var(d,!0)}Jr.boolOrEmptySchema=c;function f(l,d){const{gen:m,data:y}=l,v={gen:m,keyword:"false schema",data:y,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:l};(0,e.reportError)(v,r,void 0,d)}return Jr}var qs={},Zr={},eS;function r2(){if(eS)return Zr;eS=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.getRules=Zr.isJSONType=void 0;const e=["string","number","integer","boolean","null","object","array"],t=new Set(e);function i(o){return typeof o=="string"&&t.has(o)}Zr.isJSONType=i;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 Zr.getRules=r,Zr}var In={},tS;function a2(){if(tS)return In;tS=1,Object.defineProperty(In,"__esModule",{value:!0}),In.shouldUseRule=In.shouldUseGroup=In.schemaHasRulesForType=void 0;function e({schema:r,self:o},c){const f=o.RULES.types[c];return f&&f!==!0&&t(r,f)}In.schemaHasRulesForType=e;function t(r,o){return o.rules.some(c=>i(r,c))}In.shouldUseGroup=t;function i(r,o){var c;return r[o.keyword]!==void 0||((c=o.definition.implements)===null||c===void 0?void 0:c.some(f=>r[f]!==void 0))}return In.shouldUseRule=i,In}var sS;function _h(){if(sS)return qs;sS=1,Object.defineProperty(qs,"__esModule",{value:!0}),qs.reportTypeError=qs.checkDataTypes=qs.checkDataType=qs.coerceAndCheckDataType=qs.getJSONTypes=qs.getSchemaTypes=qs.DataType=void 0;const e=r2(),t=a2(),i=jh(),r=ft(),o=yt();var c;(function(p){p[p.Correct=0]="Correct",p[p.Wrong=1]="Wrong"})(c||(qs.DataType=c={}));function f(p){const _=l(p.type);if(_.includes("null")){if(p.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!_.length&&p.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');p.nullable===!0&&_.push("null")}return _}qs.getSchemaTypes=f;function l(p){const _=Array.isArray(p)?p:p?[p]:[];if(_.every(e.isJSONType))return _;throw new Error("type must be JSONType or JSONType[]: "+_.join(","))}qs.getJSONTypes=l;function d(p,_){const{gen:k,data:A,opts:C}=p,N=y(_,C.coerceTypes),j=_.length>0&&!(N.length===0&&_.length===1&&(0,t.schemaHasRulesForType)(p,_[0]));if(j){const M=R(_,A,C.strictNumbers,c.Wrong);k.if(M,()=>{N.length?v(p,_,N):g(p)})}return j}qs.coerceAndCheckDataType=d;const m=new Set(["string","number","integer","boolean","null"]);function y(p,_){return _?p.filter(k=>m.has(k)||_==="array"&&k==="array"):[]}function v(p,_,k){const{gen:A,data:C,opts:N}=p,j=A.let("dataType",(0,r._)`typeof ${C}`),M=A.let("coerced",(0,r._)`undefined`);N.coerceTypes==="array"&&A.if((0,r._)`${j} == 'object' && Array.isArray(${C}) && ${C}.length == 1`,()=>A.assign(C,(0,r._)`${C}[0]`).assign(j,(0,r._)`typeof ${C}`).if(R(_,C,N.strictNumbers),()=>A.assign(M,C))),A.if((0,r._)`${M} !== undefined`);for(const B of k)(m.has(B)||B==="array"&&N.coerceTypes==="array")&&O(B);A.else(),g(p),A.endIf(),A.if((0,r._)`${M} !== undefined`,()=>{A.assign(C,M),S(p,M)});function O(B){switch(B){case"string":A.elseIf((0,r._)`${j} == "number" || ${j} == "boolean"`).assign(M,(0,r._)`"" + ${C}`).elseIf((0,r._)`${C} === null`).assign(M,(0,r._)`""`);return;case"number":A.elseIf((0,r._)`${j} == "boolean" || ${C} === null
473
+ || (${j} == "string" && ${C} && ${C} == +${C})`).assign(M,(0,r._)`+${C}`);return;case"integer":A.elseIf((0,r._)`${j} === "boolean" || ${C} === null
474
+ || (${j} === "string" && ${C} && ${C} == +${C} && !(${C} % 1))`).assign(M,(0,r._)`+${C}`);return;case"boolean":A.elseIf((0,r._)`${C} === "false" || ${C} === 0 || ${C} === null`).assign(M,!1).elseIf((0,r._)`${C} === "true" || ${C} === 1`).assign(M,!0);return;case"null":A.elseIf((0,r._)`${C} === "" || ${C} === 0 || ${C} === false`),A.assign(M,null);return;case"array":A.elseIf((0,r._)`${j} === "string" || ${j} === "number"
475
+ || ${j} === "boolean" || ${C} === null`).assign(M,(0,r._)`[${C}]`)}}}function S({gen:p,parentData:_,parentDataProperty:k},A){p.if((0,r._)`${_} !== undefined`,()=>p.assign((0,r._)`${_}[${k}]`,A))}function w(p,_,k,A=c.Correct){const C=A===c.Correct?r.operators.EQ:r.operators.NEQ;let N;switch(p){case"null":return(0,r._)`${_} ${C} null`;case"array":N=(0,r._)`Array.isArray(${_})`;break;case"object":N=(0,r._)`${_} && typeof ${_} == "object" && !Array.isArray(${_})`;break;case"integer":N=j((0,r._)`!(${_} % 1) && !isNaN(${_})`);break;case"number":N=j();break;default:return(0,r._)`typeof ${_} ${C} ${p}`}return A===c.Correct?N:(0,r.not)(N);function j(M=r.nil){return(0,r.and)((0,r._)`typeof ${_} == "number"`,M,k?(0,r._)`isFinite(${_})`:r.nil)}}qs.checkDataType=w;function R(p,_,k,A){if(p.length===1)return w(p[0],_,k,A);let C;const N=(0,o.toHash)(p);if(N.array&&N.object){const j=(0,r._)`typeof ${_} != "object"`;C=N.null?j:(0,r._)`!${_} || ${j}`,delete N.null,delete N.array,delete N.object}else C=r.nil;N.number&&delete N.integer;for(const j in N)C=(0,r.and)(C,w(j,_,k,A));return C}qs.checkDataTypes=R;const x={message:({schema:p})=>`must be ${p}`,params:({schema:p,schemaValue:_})=>typeof p=="string"?(0,r._)`{type: ${p}}`:(0,r._)`{type: ${_}}`};function g(p){const _=b(p);(0,i.reportError)(_,x)}qs.reportTypeError=g;function b(p){const{gen:_,data:k,schema:A}=p,C=(0,o.schemaRefOrVal)(p,A,"type");return{gen:_,keyword:"type",data:k,schema:A.type,schemaCode:C,schemaValue:C,parentSchema:A,params:{},it:p}}return qs}var Dl={},iS;function G5(){if(iS)return Dl;iS=1,Object.defineProperty(Dl,"__esModule",{value:!0}),Dl.assignDefaults=void 0;const e=ft(),t=yt();function i(o,c){const{properties:f,items:l}=o.schema;if(c==="object"&&f)for(const d in f)r(o,d,f[d].default);else c==="array"&&Array.isArray(l)&&l.forEach((d,m)=>r(o,m,d.default))}Dl.assignDefaults=i;function r(o,c,f){const{gen:l,compositeRule:d,data:m,opts:y}=o;if(f===void 0)return;const v=(0,e._)`${m}${(0,e.getProperty)(c)}`;if(d){(0,t.checkStrictMode)(o,`default is ignored for: ${v}`);return}let S=(0,e._)`${v} === undefined`;y.useDefaults==="empty"&&(S=(0,e._)`${S} || ${v} === null || ${v} === ""`),l.if(S,(0,e._)`${v} = ${(0,e.stringify)(f)}`)}return Dl}var Xi={},Ut={},nS;function tn(){if(nS)return Ut;nS=1,Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.validateUnion=Ut.validateArray=Ut.usePattern=Ut.callValidateCode=Ut.schemaProperties=Ut.allSchemaProperties=Ut.noPropertyInData=Ut.propertyInData=Ut.isOwnProperty=Ut.hasPropFunc=Ut.reportMissingProp=Ut.checkMissingProp=Ut.checkReportMissingProp=void 0;const e=ft(),t=yt(),i=en(),r=yt();function o(p,_){const{gen:k,data:A,it:C}=p;k.if(y(k,A,_,C.opts.ownProperties),()=>{p.setParams({missingProperty:(0,e._)`${_}`},!0),p.error()})}Ut.checkReportMissingProp=o;function c({gen:p,data:_,it:{opts:k}},A,C){return(0,e.or)(...A.map(N=>(0,e.and)(y(p,_,N,k.ownProperties),(0,e._)`${C} = ${N}`)))}Ut.checkMissingProp=c;function f(p,_){p.setParams({missingProperty:_},!0),p.error()}Ut.reportMissingProp=f;function l(p){return p.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,e._)`Object.prototype.hasOwnProperty`})}Ut.hasPropFunc=l;function d(p,_,k){return(0,e._)`${l(p)}.call(${_}, ${k})`}Ut.isOwnProperty=d;function m(p,_,k,A){const C=(0,e._)`${_}${(0,e.getProperty)(k)} !== undefined`;return A?(0,e._)`${C} && ${d(p,_,k)}`:C}Ut.propertyInData=m;function y(p,_,k,A){const C=(0,e._)`${_}${(0,e.getProperty)(k)} === undefined`;return A?(0,e.or)(C,(0,e.not)(d(p,_,k))):C}Ut.noPropertyInData=y;function v(p){return p?Object.keys(p).filter(_=>_!=="__proto__"):[]}Ut.allSchemaProperties=v;function S(p,_){return v(_).filter(k=>!(0,t.alwaysValidSchema)(p,_[k]))}Ut.schemaProperties=S;function w({schemaCode:p,data:_,it:{gen:k,topSchemaRef:A,schemaPath:C,errorPath:N},it:j},M,O,B){const q=B?(0,e._)`${p}, ${_}, ${A}${C}`:_,V=[[i.default.instancePath,(0,e.strConcat)(i.default.instancePath,N)],[i.default.parentData,j.parentData],[i.default.parentDataProperty,j.parentDataProperty],[i.default.rootData,i.default.rootData]];j.opts.dynamicRef&&V.push([i.default.dynamicAnchors,i.default.dynamicAnchors]);const J=(0,e._)`${q}, ${k.object(...V)}`;return O!==e.nil?(0,e._)`${M}.call(${O}, ${J})`:(0,e._)`${M}(${J})`}Ut.callValidateCode=w;const R=(0,e._)`new RegExp`;function x({gen:p,it:{opts:_}},k){const A=_.unicodeRegExp?"u":"",{regExp:C}=_.code,N=C(k,A);return p.scopeValue("pattern",{key:N.toString(),ref:N,code:(0,e._)`${C.code==="new RegExp"?R:(0,r.useFunc)(p,C)}(${k}, ${A})`})}Ut.usePattern=x;function g(p){const{gen:_,data:k,keyword:A,it:C}=p,N=_.name("valid");if(C.allErrors){const M=_.let("valid",!0);return j(()=>_.assign(M,!1)),M}return _.var(N,!0),j(()=>_.break()),N;function j(M){const O=_.const("len",(0,e._)`${k}.length`);_.forRange("i",0,O,B=>{p.subschema({keyword:A,dataProp:B,dataPropType:t.Type.Num},N),_.if((0,e.not)(N),M)})}}Ut.validateArray=g;function b(p){const{gen:_,schema:k,keyword:A,it:C}=p;if(!Array.isArray(k))throw new Error("ajv implementation error");if(k.some(O=>(0,t.alwaysValidSchema)(C,O))&&!C.opts.unevaluated)return;const j=_.let("valid",!1),M=_.name("_valid");_.block(()=>k.forEach((O,B)=>{const q=p.subschema({keyword:A,schemaProp:B,compositeRule:!0},M);_.assign(j,(0,e._)`${j} || ${M}`),p.mergeValidEvaluated(q,M)||_.if((0,e.not)(j))})),p.result(j,()=>p.reset(),()=>p.error(!0))}return Ut.validateUnion=b,Ut}var rS;function K5(){if(rS)return Xi;rS=1,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.validateKeywordUsage=Xi.validSchemaType=Xi.funcKeywordCode=Xi.macroKeywordCode=void 0;const e=ft(),t=en(),i=tn(),r=jh();function o(S,w){const{gen:R,keyword:x,schema:g,parentSchema:b,it:p}=S,_=w.macro.call(p.self,g,b,p),k=m(R,x,_);p.opts.validateSchema!==!1&&p.self.validateSchema(_,!0);const A=R.name("valid");S.subschema({schema:_,schemaPath:e.nil,errSchemaPath:`${p.errSchemaPath}/${x}`,topSchemaRef:k,compositeRule:!0},A),S.pass(A,()=>S.error(!0))}Xi.macroKeywordCode=o;function c(S,w){var R;const{gen:x,keyword:g,schema:b,parentSchema:p,$data:_,it:k}=S;d(k,w);const A=!_&&w.compile?w.compile.call(k.self,b,p,k):w.validate,C=m(x,g,A),N=x.let("valid");S.block$data(N,j),S.ok((R=w.valid)!==null&&R!==void 0?R:N);function j(){if(w.errors===!1)B(),w.modifying&&f(S),q(()=>S.error());else{const V=w.async?M():O();w.modifying&&f(S),q(()=>l(S,V))}}function M(){const V=x.let("ruleErrs",null);return x.try(()=>B((0,e._)`await `),J=>x.assign(N,!1).if((0,e._)`${J} instanceof ${k.ValidationError}`,()=>x.assign(V,(0,e._)`${J}.errors`),()=>x.throw(J))),V}function O(){const V=(0,e._)`${C}.errors`;return x.assign(V,null),B(e.nil),V}function B(V=w.async?(0,e._)`await `:e.nil){const J=k.opts.passContext?t.default.this:t.default.self,ee=!("compile"in w&&!_||w.schema===!1);x.assign(N,(0,e._)`${V}${(0,i.callValidateCode)(S,C,J,ee)}`,w.modifying)}function q(V){var J;x.if((0,e.not)((J=w.valid)!==null&&J!==void 0?J:N),V)}}Xi.funcKeywordCode=c;function f(S){const{gen:w,data:R,it:x}=S;w.if(x.parentData,()=>w.assign(R,(0,e._)`${x.parentData}[${x.parentDataProperty}]`))}function l(S,w){const{gen:R}=S;R.if((0,e._)`Array.isArray(${w})`,()=>{R.assign(t.default.vErrors,(0,e._)`${t.default.vErrors} === null ? ${w} : ${t.default.vErrors}.concat(${w})`).assign(t.default.errors,(0,e._)`${t.default.vErrors}.length`),(0,r.extendErrors)(S)},()=>S.error())}function d({schemaEnv:S},w){if(w.async&&!S.$async)throw new Error("async keyword in sync schema")}function m(S,w,R){if(R===void 0)throw new Error(`keyword "${w}" failed to compile`);return S.scopeValue("keyword",typeof R=="function"?{ref:R}:{ref:R,code:(0,e.stringify)(R)})}function y(S,w,R=!1){return!w.length||w.some(x=>x==="array"?Array.isArray(S):x==="object"?S&&typeof S=="object"&&!Array.isArray(S):typeof S==x||R&&typeof S>"u")}Xi.validSchemaType=y;function v({schema:S,opts:w,self:R,errSchemaPath:x},g,b){if(Array.isArray(g.keyword)?!g.keyword.includes(b):g.keyword!==b)throw new Error("ajv implementation error");const p=g.dependencies;if(p!=null&&p.some(_=>!Object.prototype.hasOwnProperty.call(S,_)))throw new Error(`parent schema must have dependencies of ${b}: ${p.join(",")}`);if(g.validateSchema&&!g.validateSchema(S[b])){const k=`keyword "${b}" value is invalid at path "${x}": `+R.errorsText(g.validateSchema.errors);if(w.validateSchema==="log")R.logger.error(k);else throw new Error(k)}}return Xi.validateKeywordUsage=v,Xi}var Pn={},aS;function Y5(){if(aS)return Pn;aS=1,Object.defineProperty(Pn,"__esModule",{value:!0}),Pn.extendSubschemaMode=Pn.extendSubschemaData=Pn.getSubschema=void 0;const e=ft(),t=yt();function i(c,{keyword:f,schemaProp:l,schema:d,schemaPath:m,errSchemaPath:y,topSchemaRef:v}){if(f!==void 0&&d!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(f!==void 0){const S=c.schema[f];return l===void 0?{schema:S,schemaPath:(0,e._)`${c.schemaPath}${(0,e.getProperty)(f)}`,errSchemaPath:`${c.errSchemaPath}/${f}`}:{schema:S[l],schemaPath:(0,e._)`${c.schemaPath}${(0,e.getProperty)(f)}${(0,e.getProperty)(l)}`,errSchemaPath:`${c.errSchemaPath}/${f}/${(0,t.escapeFragment)(l)}`}}if(d!==void 0){if(m===void 0||y===void 0||v===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:d,schemaPath:m,topSchemaRef:v,errSchemaPath:y}}throw new Error('either "keyword" or "schema" must be passed')}Pn.getSubschema=i;function r(c,f,{dataProp:l,dataPropType:d,data:m,dataTypes:y,propertyName:v}){if(m!==void 0&&l!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:S}=f;if(l!==void 0){const{errorPath:R,dataPathArr:x,opts:g}=f,b=S.let("data",(0,e._)`${f.data}${(0,e.getProperty)(l)}`,!0);w(b),c.errorPath=(0,e.str)`${R}${(0,t.getErrorPath)(l,d,g.jsPropertySyntax)}`,c.parentDataProperty=(0,e._)`${l}`,c.dataPathArr=[...x,c.parentDataProperty]}if(m!==void 0){const R=m instanceof e.Name?m:S.let("data",m,!0);w(R),v!==void 0&&(c.propertyName=v)}y&&(c.dataTypes=y);function w(R){c.data=R,c.dataLevel=f.dataLevel+1,c.dataTypes=[],f.definedProperties=new Set,c.parentData=f.data,c.dataNames=[...f.dataNames,R]}}Pn.extendSubschemaData=r;function o(c,{jtdDiscriminator:f,jtdMetadata:l,compositeRule:d,createErrors:m,allErrors:y}){d!==void 0&&(c.compositeRule=d),m!==void 0&&(c.createErrors=m),y!==void 0&&(c.allErrors=y),c.jtdDiscriminator=f,c.jtdMetadata=l}return Pn.extendSubschemaMode=o,Pn}var ni={},Rm,oS;function o2(){return oS||(oS=1,Rm=function e(t,i){if(t===i)return!0;if(t&&i&&typeof t=="object"&&typeof i=="object"){if(t.constructor!==i.constructor)return!1;var r,o,c;if(Array.isArray(t)){if(r=t.length,r!=i.length)return!1;for(o=r;o--!==0;)if(!e(t[o],i[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===i.source&&t.flags===i.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===i.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===i.toString();if(c=Object.keys(t),r=c.length,r!==Object.keys(i).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(i,c[o]))return!1;for(o=r;o--!==0;){var f=c[o];if(!e(t[f],i[f]))return!1}return!0}return t!==t&&i!==i}),Rm}var Tm={exports:{}},lS;function X5(){if(lS)return Tm.exports;lS=1;var e=Tm.exports=function(r,o,c){typeof o=="function"&&(c=o,o={}),c=o.cb||c;var f=typeof c=="function"?c:c.pre||function(){},l=c.post||function(){};t(o,f,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,f,l,d,m,y,v,S){if(f&&typeof f=="object"&&!Array.isArray(f)){o(f,l,d,m,y,v,S);for(var w in f){var R=f[w];if(Array.isArray(R)){if(w in e.arrayKeywords)for(var x=0;x<R.length;x++)t(r,o,c,R[x],l+"/"+w+"/"+x,d,l,w,f,x)}else if(w in e.propsKeywords){if(R&&typeof R=="object")for(var g in R)t(r,o,c,R[g],l+"/"+w+"/"+i(g),d,l,w,f,g)}else(w in e.keywords||r.allKeys&&!(w in e.skipKeywords))&&t(r,o,c,R,l+"/"+w,d,l,w,f)}c(f,l,d,m,y,v,S)}}function i(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}return Tm.exports}var cS;function Rh(){if(cS)return ni;cS=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.getSchemaRefs=ni.resolveUrl=ni.normalizeId=ni._getFullPath=ni.getFullPath=ni.inlineRef=void 0;const e=yt(),t=o2(),i=X5(),r=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function o(x,g=!0){return typeof x=="boolean"?!0:g===!0?!f(x):g?l(x)<=g:!1}ni.inlineRef=o;const c=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function f(x){for(const g in x){if(c.has(g))return!0;const b=x[g];if(Array.isArray(b)&&b.some(f)||typeof b=="object"&&f(b))return!0}return!1}function l(x){let g=0;for(const b in x){if(b==="$ref")return 1/0;if(g++,!r.has(b)&&(typeof x[b]=="object"&&(0,e.eachItem)(x[b],p=>g+=l(p)),g===1/0))return 1/0}return g}function d(x,g="",b){b!==!1&&(g=v(g));const p=x.parse(g);return m(x,p)}ni.getFullPath=d;function m(x,g){return x.serialize(g).split("#")[0]+"#"}ni._getFullPath=m;const y=/#\/?$/;function v(x){return x?x.replace(y,""):""}ni.normalizeId=v;function S(x,g,b){return b=v(b),x.resolve(g,b)}ni.resolveUrl=S;const w=/^[a-z_][-a-z0-9._]*$/i;function R(x,g){if(typeof x=="boolean")return{};const{schemaId:b,uriResolver:p}=this.opts,_=v(x[b]||g),k={"":_},A=d(p,_,!1),C={},N=new Set;return i(x,{allKeys:!0},(O,B,q,V)=>{if(V===void 0)return;const J=A+B;let ee=k[V];typeof O[b]=="string"&&(ee=W.call(this,O[b])),Q.call(this,O.$anchor),Q.call(this,O.$dynamicAnchor),k[B]=ee;function W(ie){const I=this.opts.uriResolver.resolve;if(ie=v(ee?I(ee,ie):ie),N.has(ie))throw M(ie);N.add(ie);let P=this.refs[ie];return typeof P=="string"&&(P=this.refs[P]),typeof P=="object"?j(O,P.schema,ie):ie!==v(J)&&(ie[0]==="#"?(j(O,C[ie],ie),C[ie]=O):this.refs[ie]=J),ie}function Q(ie){if(typeof ie=="string"){if(!w.test(ie))throw new Error(`invalid anchor "${ie}"`);W.call(this,`#${ie}`)}}}),C;function j(O,B,q){if(B!==void 0&&!t(O,B))throw M(q)}function M(O){return new Error(`reference "${O}" resolves to more than one schema`)}}return ni.getSchemaRefs=R,ni}var uS;function Th(){if(uS)return Ln;uS=1,Object.defineProperty(Ln,"__esModule",{value:!0}),Ln.getData=Ln.KeywordCxt=Ln.validateFunctionCode=void 0;const e=W5(),t=_h(),i=a2(),r=_h(),o=G5(),c=K5(),f=Y5(),l=ft(),d=en(),m=Rh(),y=yt(),v=jh();function S(X){if(A(X)&&(N(X),k(X))){g(X);return}w(X,()=>(0,e.topBoolOrEmptySchema)(X))}Ln.validateFunctionCode=S;function w({gen:X,validateName:te,schema:ue,schemaEnv:me,opts:je},Oe){je.code.es5?X.func(te,(0,l._)`${d.default.data}, ${d.default.valCxt}`,me.$async,()=>{X.code((0,l._)`"use strict"; ${p(ue,je)}`),x(X,je),X.code(Oe)}):X.func(te,(0,l._)`${d.default.data}, ${R(je)}`,me.$async,()=>X.code(p(ue,je)).code(Oe))}function R(X){return(0,l._)`{${d.default.instancePath}="", ${d.default.parentData}, ${d.default.parentDataProperty}, ${d.default.rootData}=${d.default.data}${X.dynamicRef?(0,l._)`, ${d.default.dynamicAnchors}={}`:l.nil}}={}`}function x(X,te){X.if(d.default.valCxt,()=>{X.var(d.default.instancePath,(0,l._)`${d.default.valCxt}.${d.default.instancePath}`),X.var(d.default.parentData,(0,l._)`${d.default.valCxt}.${d.default.parentData}`),X.var(d.default.parentDataProperty,(0,l._)`${d.default.valCxt}.${d.default.parentDataProperty}`),X.var(d.default.rootData,(0,l._)`${d.default.valCxt}.${d.default.rootData}`),te.dynamicRef&&X.var(d.default.dynamicAnchors,(0,l._)`${d.default.valCxt}.${d.default.dynamicAnchors}`)},()=>{X.var(d.default.instancePath,(0,l._)`""`),X.var(d.default.parentData,(0,l._)`undefined`),X.var(d.default.parentDataProperty,(0,l._)`undefined`),X.var(d.default.rootData,d.default.data),te.dynamicRef&&X.var(d.default.dynamicAnchors,(0,l._)`{}`)})}function g(X){const{schema:te,opts:ue,gen:me}=X;w(X,()=>{ue.$comment&&te.$comment&&V(X),O(X),me.let(d.default.vErrors,null),me.let(d.default.errors,0),ue.unevaluated&&b(X),j(X),J(X)})}function b(X){const{gen:te,validateName:ue}=X;X.evaluated=te.const("evaluated",(0,l._)`${ue}.evaluated`),te.if((0,l._)`${X.evaluated}.dynamicProps`,()=>te.assign((0,l._)`${X.evaluated}.props`,(0,l._)`undefined`)),te.if((0,l._)`${X.evaluated}.dynamicItems`,()=>te.assign((0,l._)`${X.evaluated}.items`,(0,l._)`undefined`))}function p(X,te){const ue=typeof X=="object"&&X[te.schemaId];return ue&&(te.code.source||te.code.process)?(0,l._)`/*# sourceURL=${ue} */`:l.nil}function _(X,te){if(A(X)&&(N(X),k(X))){C(X,te);return}(0,e.boolOrEmptySchema)(X,te)}function k({schema:X,self:te}){if(typeof X=="boolean")return!X;for(const ue in X)if(te.RULES.all[ue])return!0;return!1}function A(X){return typeof X.schema!="boolean"}function C(X,te){const{schema:ue,gen:me,opts:je}=X;je.$comment&&ue.$comment&&V(X),B(X),q(X);const Oe=me.const("_errs",d.default.errors);j(X,Oe),me.var(te,(0,l._)`${Oe} === ${d.default.errors}`)}function N(X){(0,y.checkUnknownRules)(X),M(X)}function j(X,te){if(X.opts.jtd)return W(X,[],!1,te);const ue=(0,t.getSchemaTypes)(X.schema),me=(0,t.coerceAndCheckDataType)(X,ue);W(X,ue,!me,te)}function M(X){const{schema:te,errSchemaPath:ue,opts:me,self:je}=X;te.$ref&&me.ignoreKeywordsWithRef&&(0,y.schemaHasRulesButRef)(te,je.RULES)&&je.logger.warn(`$ref: keywords ignored in schema at path "${ue}"`)}function O(X){const{schema:te,opts:ue}=X;te.default!==void 0&&ue.useDefaults&&ue.strictSchema&&(0,y.checkStrictMode)(X,"default is ignored in the schema root")}function B(X){const te=X.schema[X.opts.schemaId];te&&(X.baseId=(0,m.resolveUrl)(X.opts.uriResolver,X.baseId,te))}function q(X){if(X.schema.$async&&!X.schemaEnv.$async)throw new Error("async schema in sync schema")}function V({gen:X,schemaEnv:te,schema:ue,errSchemaPath:me,opts:je}){const Oe=ue.$comment;if(je.$comment===!0)X.code((0,l._)`${d.default.self}.logger.log(${Oe})`);else if(typeof je.$comment=="function"){const Le=(0,l.str)`${me}/$comment`,at=X.scopeValue("root",{ref:te.root});X.code((0,l._)`${d.default.self}.opts.$comment(${Oe}, ${Le}, ${at}.schema)`)}}function J(X){const{gen:te,schemaEnv:ue,validateName:me,ValidationError:je,opts:Oe}=X;ue.$async?te.if((0,l._)`${d.default.errors} === 0`,()=>te.return(d.default.data),()=>te.throw((0,l._)`new ${je}(${d.default.vErrors})`)):(te.assign((0,l._)`${me}.errors`,d.default.vErrors),Oe.unevaluated&&ee(X),te.return((0,l._)`${d.default.errors} === 0`))}function ee({gen:X,evaluated:te,props:ue,items:me}){ue instanceof l.Name&&X.assign((0,l._)`${te}.props`,ue),me instanceof l.Name&&X.assign((0,l._)`${te}.items`,me)}function W(X,te,ue,me){const{gen:je,schema:Oe,data:Le,allErrors:at,opts:Ee,self:qe}=X,{RULES:We}=qe;if(Oe.$ref&&(Ee.ignoreKeywordsWithRef||!(0,y.schemaHasRulesButRef)(Oe,We))){je.block(()=>Y(X,"$ref",We.all.$ref.definition));return}Ee.jtd||ie(X,te),je.block(()=>{for(const Ze of We.rules)it(Ze);it(We.post)});function it(Ze){(0,i.shouldUseGroup)(Oe,Ze)&&(Ze.type?(je.if((0,r.checkDataType)(Ze.type,Le,Ee.strictNumbers)),Q(X,Ze),te.length===1&&te[0]===Ze.type&&ue&&(je.else(),(0,r.reportTypeError)(X)),je.endIf()):Q(X,Ze),at||je.if((0,l._)`${d.default.errors} === ${me||0}`))}}function Q(X,te){const{gen:ue,schema:me,opts:{useDefaults:je}}=X;je&&(0,o.assignDefaults)(X,te.type),ue.block(()=>{for(const Oe of te.rules)(0,i.shouldUseRule)(me,Oe)&&Y(X,Oe.keyword,Oe.definition,te.type)})}function ie(X,te){X.schemaEnv.meta||!X.opts.strictTypes||(I(X,te),X.opts.allowUnionTypes||P(X,te),D(X,X.dataTypes))}function I(X,te){if(te.length){if(!X.dataTypes.length){X.dataTypes=te;return}te.forEach(ue=>{U(X.dataTypes,ue)||G(X,`type "${ue}" not allowed by context "${X.dataTypes.join(",")}"`)}),L(X,te)}}function P(X,te){te.length>1&&!(te.length===2&&te.includes("null"))&&G(X,"use allowUnionTypes to allow union type keyword")}function D(X,te){const ue=X.self.RULES.all;for(const me in ue){const je=ue[me];if(typeof je=="object"&&(0,i.shouldUseRule)(X.schema,je)){const{type:Oe}=je.definition;Oe.length&&!Oe.some(Le=>H(te,Le))&&G(X,`missing type "${Oe.join(",")}" for keyword "${me}"`)}}}function H(X,te){return X.includes(te)||te==="number"&&X.includes("integer")}function U(X,te){return X.includes(te)||te==="integer"&&X.includes("number")}function L(X,te){const ue=[];for(const me of X.dataTypes)U(te,me)?ue.push(me):te.includes("integer")&&me==="number"&&ue.push("integer");X.dataTypes=ue}function G(X,te){const ue=X.schemaEnv.baseId+X.errSchemaPath;te+=` at "${ue}" (strictTypes)`,(0,y.checkStrictMode)(X,te,X.opts.strictTypes)}class se{constructor(te,ue,me){if((0,c.validateKeywordUsage)(te,ue,me),this.gen=te.gen,this.allErrors=te.allErrors,this.keyword=me,this.data=te.data,this.schema=te.schema[me],this.$data=ue.$data&&te.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,y.schemaRefOrVal)(te,this.schema,me,this.$data),this.schemaType=ue.schemaType,this.parentSchema=te.schema,this.params={},this.it=te,this.def=ue,this.$data)this.schemaCode=te.gen.const("vSchema",ae(this.$data,te));else if(this.schemaCode=this.schemaValue,!(0,c.validSchemaType)(this.schema,ue.schemaType,ue.allowUndefined))throw new Error(`${me} value must be ${JSON.stringify(ue.schemaType)}`);("code"in ue?ue.trackErrors:ue.errors!==!1)&&(this.errsCount=te.gen.const("_errs",d.default.errors))}result(te,ue,me){this.failResult((0,l.not)(te),ue,me)}failResult(te,ue,me){this.gen.if(te),me?me():this.error(),ue?(this.gen.else(),ue(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(te,ue){this.failResult((0,l.not)(te),void 0,ue)}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:ue}=this;this.fail((0,l._)`${ue} !== undefined && (${(0,l.or)(this.invalid$data(),te)})`)}error(te,ue,me){if(ue){this.setParams(ue),this._error(te,me),this.setParams({});return}this._error(te,me)}_error(te,ue){(te?v.reportExtraError:v.reportError)(this,this.def.error,ue)}$dataError(){(0,v.reportError)(this,this.def.$dataError||v.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,v.resetErrorsCount)(this.gen,this.errsCount)}ok(te){this.allErrors||this.gen.if(te)}setParams(te,ue){ue?Object.assign(this.params,te):this.params=te}block$data(te,ue,me=l.nil){this.gen.block(()=>{this.check$data(te,me),ue()})}check$data(te=l.nil,ue=l.nil){if(!this.$data)return;const{gen:me,schemaCode:je,schemaType:Oe,def:Le}=this;me.if((0,l.or)((0,l._)`${je} === undefined`,ue)),te!==l.nil&&me.assign(te,!0),(Oe.length||Le.validateSchema)&&(me.elseIf(this.invalid$data()),this.$dataError(),te!==l.nil&&me.assign(te,!1)),me.else()}invalid$data(){const{gen:te,schemaCode:ue,schemaType:me,def:je,it:Oe}=this;return(0,l.or)(Le(),at());function Le(){if(me.length){if(!(ue instanceof l.Name))throw new Error("ajv implementation error");const Ee=Array.isArray(me)?me:[me];return(0,l._)`${(0,r.checkDataTypes)(Ee,ue,Oe.opts.strictNumbers,r.DataType.Wrong)}`}return l.nil}function at(){if(je.validateSchema){const Ee=te.scopeValue("validate$data",{ref:je.validateSchema});return(0,l._)`!${Ee}(${ue})`}return l.nil}}subschema(te,ue){const me=(0,f.getSubschema)(this.it,te);(0,f.extendSubschemaData)(me,this.it,te),(0,f.extendSubschemaMode)(me,te);const je={...this.it,...me,items:void 0,props:void 0};return _(je,ue),je}mergeEvaluated(te,ue){const{it:me,gen:je}=this;me.opts.unevaluated&&(me.props!==!0&&te.props!==void 0&&(me.props=y.mergeEvaluated.props(je,te.props,me.props,ue)),me.items!==!0&&te.items!==void 0&&(me.items=y.mergeEvaluated.items(je,te.items,me.items,ue)))}mergeValidEvaluated(te,ue){const{it:me,gen:je}=this;if(me.opts.unevaluated&&(me.props!==!0||me.items!==!0))return je.if(ue,()=>this.mergeEvaluated(te,l.Name)),!0}}Ln.KeywordCxt=se;function Y(X,te,ue,me){const je=new se(X,ue,te);"code"in ue?ue.code(je,me):je.$data&&ue.validate?(0,c.funcKeywordCode)(je,ue):"macro"in ue?(0,c.macroKeywordCode)(je,ue):(ue.compile||ue.validate)&&(0,c.funcKeywordCode)(je,ue)}const F=/^\/(?:[^~]|~0|~1)*$/,le=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ae(X,{dataLevel:te,dataNames:ue,dataPathArr:me}){let je,Oe;if(X==="")return d.default.rootData;if(X[0]==="/"){if(!F.test(X))throw new Error(`Invalid JSON-pointer: ${X}`);je=X,Oe=d.default.rootData}else{const qe=le.exec(X);if(!qe)throw new Error(`Invalid JSON-pointer: ${X}`);const We=+qe[1];if(je=qe[2],je==="#"){if(We>=te)throw new Error(Ee("property/index",We));return me[te-We]}if(We>te)throw new Error(Ee("data",We));if(Oe=ue[te-We],!je)return Oe}let Le=Oe;const at=je.split("/");for(const qe of at)qe&&(Oe=(0,l._)`${Oe}${(0,l.getProperty)((0,y.unescapeJsonPointer)(qe))}`,Le=(0,l._)`${Le} && ${Oe}`);return Le;function Ee(qe,We){return`Cannot access ${qe} ${We} levels up, current level is ${te}`}}return Ln.getData=ae,Ln}var $u={},dS;function _g(){if(dS)return $u;dS=1,Object.defineProperty($u,"__esModule",{value:!0});class e extends Error{constructor(i){super("validation failed"),this.errors=i,this.ajv=this.validation=!0}}return $u.default=e,$u}var Lu={},hS;function Nh(){if(hS)return Lu;hS=1,Object.defineProperty(Lu,"__esModule",{value:!0});const e=Rh();class t extends Error{constructor(r,o,c,f){super(f||`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 Lu.default=t,Lu}var Ai={},fS;function Mh(){if(fS)return Ai;fS=1,Object.defineProperty(Ai,"__esModule",{value:!0}),Ai.resolveSchema=Ai.getCompilingSchema=Ai.resolveRef=Ai.compileSchema=Ai.SchemaEnv=void 0;const e=ft(),t=_g(),i=en(),r=Rh(),o=yt(),c=Th();class f{constructor(b){var p;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=(p=b.baseId)!==null&&p!==void 0?p:(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={}}}Ai.SchemaEnv=f;function l(g){const b=y.call(this,g);if(b)return b;const p=(0,r.getFullPath)(this.opts.uriResolver,g.root.baseId),{es5:_,lines:k}=this.opts.code,{ownProperties:A}=this.opts,C=new e.CodeGen(this.scope,{es5:_,lines:k,ownProperties:A});let N;g.$async&&(N=C.scopeValue("Error",{ref:t.default,code:(0,e._)`require("ajv/dist/runtime/validation_error").default`}));const j=C.scopeName("validate");g.validateName=j;const M={gen:C,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:C.scopeValue("schema",this.opts.code.source===!0?{ref:g.schema,code:(0,e.stringify)(g.schema)}:{ref:g.schema}),validateName:j,ValidationError:N,schema:g.schema,schemaEnv:g,rootId:p,baseId:g.baseId||p,schemaPath:e.nil,errSchemaPath:g.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,e._)`""`,opts:this.opts,self:this};let O;try{this._compilations.add(g),(0,c.validateFunctionCode)(M),C.optimize(this.opts.code.optimize);const B=C.toString();O=`${C.scopeRefs(i.default.scope)}return ${B}`,this.opts.code.process&&(O=this.opts.code.process(O,g));const V=new Function(`${i.default.self}`,`${i.default.scope}`,O)(this,this.scope.get());if(this.scope.value(j,{ref:V}),V.errors=null,V.schema=g.schema,V.schemaEnv=g,g.$async&&(V.$async=!0),this.opts.code.source===!0&&(V.source={validateName:j,validateCode:B,scopeValues:C._values}),this.opts.unevaluated){const{props:J,items:ee}=M;V.evaluated={props:J instanceof e.Name?void 0:J,items:ee instanceof e.Name?void 0:ee,dynamicProps:J instanceof e.Name,dynamicItems:ee instanceof e.Name},V.source&&(V.source.evaluated=(0,e.stringify)(V.evaluated))}return g.validate=V,g}catch(B){throw delete g.validate,delete g.validateName,O&&this.logger.error("Error compiling schema, function code:",O),B}finally{this._compilations.delete(g)}}Ai.compileSchema=l;function d(g,b,p){var _;p=(0,r.resolveUrl)(this.opts.uriResolver,b,p);const k=g.refs[p];if(k)return k;let A=S.call(this,g,p);if(A===void 0){const C=(_=g.localRefs)===null||_===void 0?void 0:_[p],{schemaId:N}=this.opts;C&&(A=new f({schema:C,schemaId:N,root:g,baseId:b}))}if(A!==void 0)return g.refs[p]=m.call(this,A)}Ai.resolveRef=d;function m(g){return(0,r.inlineRef)(g.schema,this.opts.inlineRefs)?g.schema:g.validate?g:l.call(this,g)}function y(g){for(const b of this._compilations)if(v(b,g))return b}Ai.getCompilingSchema=y;function v(g,b){return g.schema===b.schema&&g.root===b.root&&g.baseId===b.baseId}function S(g,b){let p;for(;typeof(p=this.refs[b])=="string";)b=p;return p||this.schemas[b]||w.call(this,g,b)}function w(g,b){const p=this.opts.uriResolver.parse(b),_=(0,r._getFullPath)(this.opts.uriResolver,p);let k=(0,r.getFullPath)(this.opts.uriResolver,g.baseId,void 0);if(Object.keys(g.schema).length>0&&_===k)return x.call(this,p,g);const A=(0,r.normalizeId)(_),C=this.refs[A]||this.schemas[A];if(typeof C=="string"){const N=w.call(this,g,C);return typeof(N==null?void 0:N.schema)!="object"?void 0:x.call(this,p,N)}if(typeof(C==null?void 0:C.schema)=="object"){if(C.validate||l.call(this,C),A===(0,r.normalizeId)(b)){const{schema:N}=C,{schemaId:j}=this.opts,M=N[j];return M&&(k=(0,r.resolveUrl)(this.opts.uriResolver,k,M)),new f({schema:N,schemaId:j,root:g,baseId:k})}return x.call(this,p,C)}}Ai.resolveSchema=w;const R=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function x(g,{baseId:b,schema:p,root:_}){var k;if(((k=g.fragment)===null||k===void 0?void 0:k[0])!=="/")return;for(const N of g.fragment.slice(1).split("/")){if(typeof p=="boolean")return;const j=p[(0,o.unescapeFragment)(N)];if(j===void 0)return;p=j;const M=typeof p=="object"&&p[this.opts.schemaId];!R.has(N)&&M&&(b=(0,r.resolveUrl)(this.opts.uriResolver,b,M))}let A;if(typeof p!="boolean"&&p.$ref&&!(0,o.schemaHasRulesButRef)(p,this.RULES)){const N=(0,r.resolveUrl)(this.opts.uriResolver,b,p.$ref);A=w.call(this,_,N)}const{schemaId:C}=this.opts;if(A=A||new f({schema:p,schemaId:C,root:_,baseId:b}),A.schema!==A.root.schema)return A}return Ai}const J5="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",Z5="Meta-schema for $data reference (JSON AnySchema extension proposal)",Q5="object",eM=["$data"],tM={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},sM=!1,iM={$id:J5,description:Z5,type:Q5,required:eM,properties:tM,additionalProperties:sM};var Iu={},Ol={exports:{}},Nm,pS;function l2(){if(pS)return Nm;pS=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),i=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(A){let C="",N=0,j=0;for(j=0;j<A.length;j++)if(N=A[j].charCodeAt(0),N!==48){if(!(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102))return"";C+=A[j];break}for(j+=1;j<A.length;j++){if(N=A[j].charCodeAt(0),!(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102))return"";C+=A[j]}return C}const f=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function l(A){return A.length=0,!0}function d(A,C,N){if(A.length){const j=c(A);if(j!=="")C.push(j);else return N.error=!0,!1;A.length=0}return!0}function m(A){let C=0;const N={error:!1,address:"",zone:""},j=[],M=[];let O=!1,B=!1,q=d;for(let V=0;V<A.length;V++){const J=A[V];if(!(J==="["||J==="]"))if(J===":"){if(O===!0&&(B=!0),!q(M,j,N))break;if(++C>7){N.error=!0;break}V>0&&A[V-1]===":"&&(O=!0),j.push(":");continue}else if(J==="%"){if(!q(M,j,N))break;q=l}else{M.push(J);continue}}return M.length&&(q===l?N.zone=M.join(""):B?j.push(M.join("")):j.push(c(M))),N.address=j.join(""),N}function y(A){if(v(A,":")<2)return{host:A,isIPV6:!1};const C=m(A);if(C.error)return{host:A,isIPV6:!1};{let N=C.address,j=C.address;return C.zone&&(N+="%"+C.zone,j+="%25"+C.zone),{host:N,isIPV6:!0,escapedHost:j}}}function v(A,C){let N=0;for(let j=0;j<A.length;j++)A[j]===C&&N++;return N}function S(A){let C=A;const N=[];let j=-1,M=0;for(;M=C.length;){if(M===1){if(C===".")break;if(C==="/"){N.push("/");break}else{N.push(C);break}}else if(M===2){if(C[0]==="."){if(C[1]===".")break;if(C[1]==="/"){C=C.slice(2);continue}}else if(C[0]==="/"&&(C[1]==="."||C[1]==="/")){N.push("/");break}}else if(M===3&&C==="/.."){N.length!==0&&N.pop(),N.push("/");break}if(C[0]==="."){if(C[1]==="."){if(C[2]==="/"){C=C.slice(3);continue}}else if(C[1]==="/"){C=C.slice(2);continue}}else if(C[0]==="/"&&C[1]==="."){if(C[2]==="/"){C=C.slice(2);continue}else if(C[2]==="."&&C[3]==="/"){C=C.slice(3),N.length!==0&&N.pop();continue}}if((j=C.indexOf("/",1))===-1){N.push(C);break}else N.push(C.slice(0,j)),C=C.slice(j)}return N.join("")}const w={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},R=/[@/?#:]/g,x=/[@/?#]/g;function g(A,C){const N=C?x:R;return N.lastIndex=0,A.replace(N,j=>w[j])}function b(A,C=!1){if(A.indexOf("%")===-1)return A;let N="";for(let j=0;j<A.length;j++){if(A[j]==="%"&&j+2<A.length){const M=A.slice(j+1,j+3);if(i(M)){const O=M.toUpperCase(),B=String.fromCharCode(parseInt(O,16));C&&r(B)?N+=B:N+="%"+O,j+=2;continue}}N+=A[j]}return N}function p(A){let C="";for(let N=0;N<A.length;N++){if(A[N]==="%"&&N+2<A.length){const j=A.slice(N+1,N+3);if(i(j)){const M=j.toUpperCase(),O=String.fromCharCode(parseInt(M,16));O!=="."&&r(O)?C+=O:C+="%"+M,N+=2;continue}}o(A[N])?C+=A[N]:C+=escape(A[N])}return C}function _(A){let C="";for(let N=0;N<A.length;N++){if(A[N]==="%"&&N+2<A.length){const j=A.slice(N+1,N+3);if(i(j)){C+="%"+j.toUpperCase(),N+=2;continue}}C+=escape(A[N])}return C}function k(A){const C=[];if(A.userinfo!==void 0&&(C.push(A.userinfo),C.push("@")),A.host!==void 0){let N=unescape(A.host);if(!t(N)){const j=y(N);j.isIPV6===!0?N=`[${j.escapedHost}]`:N=g(N,!1)}C.push(N)}return(typeof A.port=="number"||typeof A.port=="string")&&(C.push(":"),C.push(String(A.port))),C.length?C.join(""):void 0}return Nm={nonSimpleDomain:f,recomposeAuthority:k,reescapeHostDelimiters:g,normalizePercentEncoding:b,normalizePathEncoding:p,escapePreservingEscapes:_,removeDotSegments:S,isIPv4:t,isUUID:e,normalizeIPv6:y,stringArrayToHexStripped:c},Nm}var Mm,mS;function nM(){if(mS)return Mm;mS=1;const{isUUID:e}=l2(),t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=["http","https","ws","wss","urn","urn:uuid"];function r(A){return i.indexOf(A)!==-1}function o(A){return A.secure===!0?!0:A.secure===!1?!1:A.scheme?A.scheme.length===3&&(A.scheme[0]==="w"||A.scheme[0]==="W")&&(A.scheme[1]==="s"||A.scheme[1]==="S")&&(A.scheme[2]==="s"||A.scheme[2]==="S"):!1}function c(A){return A.host||(A.error=A.error||"HTTP URIs must have a host."),A}function f(A){const C=String(A.scheme).toLowerCase()==="https";return(A.port===(C?443:80)||A.port==="")&&(A.port=void 0),A.path||(A.path="/"),A}function l(A){return A.secure=o(A),A.resourceName=(A.path||"/")+(A.query?"?"+A.query:""),A.path=void 0,A.query=void 0,A}function d(A){if((A.port===(o(A)?443:80)||A.port==="")&&(A.port=void 0),typeof A.secure=="boolean"&&(A.scheme=A.secure?"wss":"ws",A.secure=void 0),A.resourceName){const[C,N]=A.resourceName.split("?");A.path=C&&C!=="/"?C:void 0,A.query=N,A.resourceName=void 0}return A.fragment=void 0,A}function m(A,C){if(!A.path)return A.error="URN can not be parsed",A;const N=A.path.match(t);if(N){const j=C.scheme||A.scheme||"urn";A.nid=N[1].toLowerCase(),A.nss=N[2];const M=`${j}:${C.nid||A.nid}`,O=k(M);A.path=void 0,O&&(A=O.parse(A,C))}else A.error=A.error||"URN can not be parsed.";return A}function y(A,C){if(A.nid===void 0)throw new Error("URN without nid cannot be serialized");const N=C.scheme||A.scheme||"urn",j=A.nid.toLowerCase(),M=`${N}:${C.nid||j}`,O=k(M);O&&(A=O.serialize(A,C));const B=A,q=A.nss;return B.path=`${j||C.nid}:${q}`,C.skipEscape=!0,B}function v(A,C){const N=A;return N.uuid=N.nss,N.nss=void 0,!C.tolerant&&(!N.uuid||!e(N.uuid))&&(N.error=N.error||"UUID is not valid."),N}function S(A){const C=A;return C.nss=(A.uuid||"").toLowerCase(),C}const w={scheme:"http",domainHost:!0,parse:c,serialize:f},R={scheme:"https",domainHost:w.domainHost,parse:c,serialize:f},x={scheme:"ws",domainHost:!0,parse:l,serialize:d},g={scheme:"wss",domainHost:x.domainHost,parse:x.parse,serialize:x.serialize},_={http:w,https:R,ws:x,wss:g,urn:{scheme:"urn",parse:m,serialize:y,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:v,serialize:S,skipNormalize:!0}};Object.setPrototypeOf(_,null);function k(A){return A&&(_[A]||_[A.toLowerCase()])||void 0}return Mm={wsIsSecure:o,SCHEMES:_,isValidSchemeName:r,getSchemeHandler:k},Mm}var vS;function rM(){if(vS)return Ol.exports;vS=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:i,normalizePercentEncoding:r,normalizePathEncoding:o,escapePreservingEscapes:c,reescapeHostDelimiters:f,isIPv4:l,nonSimpleDomain:d}=l2(),{SCHEMES:m,getSchemeHandler:y}=nM();function v(j,M){return typeof j=="string"?j=k(j,M):typeof j=="object"&&(j=_(x(j,M),M)),j}function S(j,M,O){const B=O?Object.assign({scheme:"null"},O):{scheme:"null"},q=w(_(j,B),_(M,B),B,!0);return B.skipEscape=!0,x(q,B)}function w(j,M,O,B){const q={};return B||(j=_(x(j,O),O),M=_(x(M,O),O)),O=O||{},!O.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 R(j,M,O){const B=C(j,O),q=C(M,O);return B!==void 0&&q!==void 0&&B.toLowerCase()===q.toLowerCase()}function x(j,M){const O={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:""},B=Object.assign({},M),q=[],V=y(B.scheme||O.scheme);V&&V.serialize&&V.serialize(O,B),O.path!==void 0&&(B.skipEscape?O.path=r(O.path):(O.path=c(O.path),O.scheme!==void 0&&(O.path=O.path.split("%3A").join(":")))),B.reference!=="suffix"&&O.scheme&&q.push(O.scheme,":");const J=i(O);if(J!==void 0&&(B.reference!=="suffix"&&q.push("//"),q.push(J),O.path&&O.path[0]!=="/"&&q.push("/")),O.path!==void 0){let ee=O.path;!B.absolutePath&&(!V||!V.absolutePath)&&(ee=t(ee)),J===void 0&&ee[0]==="/"&&ee[1]==="/"&&(ee="/%2F"+ee.slice(2)),q.push(ee)}return O.query!==void 0&&q.push("?",O.query),O.fragment!==void 0&&q.push("#",O.fragment),q.join("")}const g=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\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 p(j,M){const O=Object.assign({},M),B={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let q=!1,V=!1;O.reference==="suffix"&&(O.scheme?j=O.scheme+":"+j:j="//"+j);const J=j.match(g);if(J){B.scheme=J[1],B.userinfo=J[3],B.host=J[4],B.port=parseInt(J[5],10),B.path=J[6]||"",B.query=J[7],B.fragment=J[8],isNaN(B.port)&&(B.port=J[5]);const ee=b(B,J);if(ee!==void 0&&(B.error=B.error||ee,q=!0),B.host)if(l(B.host)===!1){const ie=e(B.host);B.host=ie.host.toLowerCase(),V=ie.isIPV6}else V=!0;B.scheme===void 0&&B.userinfo===void 0&&B.host===void 0&&B.port===void 0&&B.query===void 0&&!B.path?B.reference="same-document":B.scheme===void 0?B.reference="relative":B.fragment===void 0?B.reference="absolute":B.reference="uri",O.reference&&O.reference!=="suffix"&&O.reference!==B.reference&&(B.error=B.error||"URI is not a "+O.reference+" reference.");const W=y(O.scheme||B.scheme);if(!O.unicodeSupport&&(!W||!W.unicodeSupport)&&B.host&&(O.domainHost||W&&W.domainHost)&&V===!1&&d(B.host))try{B.host=URL.domainToASCII(B.host.toLowerCase())}catch(Q){B.error=B.error||"Host's domain name can not be converted to ASCII: "+Q}if((!W||W&&!W.skipNormalize)&&(j.indexOf("%")!==-1&&(B.scheme!==void 0&&(B.scheme=unescape(B.scheme)),B.host!==void 0&&(B.host=f(unescape(B.host),V))),B.path&&(B.path=o(B.path)),B.fragment))try{B.fragment=encodeURI(decodeURIComponent(B.fragment))}catch{B.error=B.error||"URI malformed"}W&&W.parse&&W.parse(B,O)}else B.error=B.error||"URI can not be parsed.";return{parsed:B,malformedAuthorityOrPort:q}}function _(j,M){return p(j,M).parsed}function k(j,M){return A(j,M).normalized}function A(j,M){const{parsed:O,malformedAuthorityOrPort:B}=p(j,M);return{normalized:B?j:x(O,M),malformedAuthorityOrPort:B}}function C(j,M){if(typeof j=="string"){const{normalized:O,malformedAuthorityOrPort:B}=A(j,M);return B?void 0:O}if(typeof j=="object")return x(j,M)}const N={SCHEMES:m,normalize:v,resolve:S,resolveComponent:w,equal:R,serialize:x,parse:_};return Ol.exports=N,Ol.exports.default=N,Ol.exports.fastUri=N,Ol.exports}var gS;function aM(){if(gS)return Iu;gS=1,Object.defineProperty(Iu,"__esModule",{value:!0});const e=rM();return e.code='require("ajv/dist/runtime/uri").default',Iu.default=e,Iu}var _S;function oM(){return _S||(_S=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=Th();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var i=ft();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return i.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return i.CodeGen}});const r=_g(),o=Nh(),c=r2(),f=Mh(),l=ft(),d=Rh(),m=_h(),y=yt(),v=iM,S=aM(),w=(P,D)=>new RegExp(P,D);w.code="new RegExp";const R=["removeAdditional","useDefaults","coerceTypes"],x=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={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.'},p=200;function _(P){var D,H,U,L,G,se,Y,F,le,ae,X,te,ue,me,je,Oe,Le,at,Ee,qe,We,it,Ze,Je,wt;const mt=P.strict,Qt=(D=P.code)===null||D===void 0?void 0:D.optimize,Mt=Qt===!0||Qt===void 0?1:Qt||0,At=(U=(H=P.code)===null||H===void 0?void 0:H.regExp)!==null&&U!==void 0?U:w,hs=(L=P.uriResolver)!==null&&L!==void 0?L:S.default;return{strictSchema:(se=(G=P.strictSchema)!==null&&G!==void 0?G:mt)!==null&&se!==void 0?se:!0,strictNumbers:(F=(Y=P.strictNumbers)!==null&&Y!==void 0?Y:mt)!==null&&F!==void 0?F:!0,strictTypes:(ae=(le=P.strictTypes)!==null&&le!==void 0?le:mt)!==null&&ae!==void 0?ae:"log",strictTuples:(te=(X=P.strictTuples)!==null&&X!==void 0?X:mt)!==null&&te!==void 0?te:"log",strictRequired:(me=(ue=P.strictRequired)!==null&&ue!==void 0?ue:mt)!==null&&me!==void 0?me:!1,code:P.code?{...P.code,optimize:Mt,regExp:At}:{optimize:Mt,regExp:At},loopRequired:(je=P.loopRequired)!==null&&je!==void 0?je:p,loopEnum:(Oe=P.loopEnum)!==null&&Oe!==void 0?Oe:p,meta:(Le=P.meta)!==null&&Le!==void 0?Le:!0,messages:(at=P.messages)!==null&&at!==void 0?at:!0,inlineRefs:(Ee=P.inlineRefs)!==null&&Ee!==void 0?Ee:!0,schemaId:(qe=P.schemaId)!==null&&qe!==void 0?qe:"$id",addUsedSchema:(We=P.addUsedSchema)!==null&&We!==void 0?We:!0,validateSchema:(it=P.validateSchema)!==null&&it!==void 0?it:!0,validateFormats:(Ze=P.validateFormats)!==null&&Ze!==void 0?Ze:!0,unicodeRegExp:(Je=P.unicodeRegExp)!==null&&Je!==void 0?Je:!0,int32range:(wt=P.int32range)!==null&&wt!==void 0?wt:!0,uriResolver:hs}}class k{constructor(D={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,D=this.opts={...D,..._(D)};const{es5:H,lines:U}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:x,es5:H,lines:U}),this.logger=q(D.logger);const L=D.validateFormats;D.validateFormats=!1,this.RULES=(0,c.getRules)(),A.call(this,g,D,"NOT SUPPORTED"),A.call(this,b,D,"DEPRECATED","warn"),this._metaOpts=O.call(this),D.formats&&j.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),D.keywords&&M.call(this,D.keywords),typeof D.meta=="object"&&this.addMetaSchema(D.meta),N.call(this),D.validateFormats=L}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:D,meta:H,schemaId:U}=this.opts;let L=v;U==="id"&&(L={...v},L.id=L.$id,delete L.$id),H&&D&&this.addMetaSchema(L,L[U],!1)}defaultMeta(){const{meta:D,schemaId:H}=this.opts;return this.opts.defaultMeta=typeof D=="object"?D[H]||D:void 0}validate(D,H){let U;if(typeof D=="string"){if(U=this.getSchema(D),!U)throw new Error(`no schema with key or ref "${D}"`)}else U=this.compile(D);const L=U(H);return"$async"in U||(this.errors=U.errors),L}compile(D,H){const U=this._addSchema(D,H);return U.validate||this._compileSchemaEnv(U)}compileAsync(D,H){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:U}=this.opts;return L.call(this,D,H);async function L(ae,X){await G.call(this,ae.$schema);const te=this._addSchema(ae,X);return te.validate||se.call(this,te)}async function G(ae){ae&&!this.getSchema(ae)&&await L.call(this,{$ref:ae},!0)}async function se(ae){try{return this._compileSchemaEnv(ae)}catch(X){if(!(X instanceof o.default))throw X;return Y.call(this,X),await F.call(this,X.missingSchema),se.call(this,ae)}}function Y({missingSchema:ae,missingRef:X}){if(this.refs[ae])throw new Error(`AnySchema ${ae} is loaded but ${X} cannot be resolved`)}async function F(ae){const X=await le.call(this,ae);this.refs[ae]||await G.call(this,X.$schema),this.refs[ae]||this.addSchema(X,ae,H)}async function le(ae){const X=this._loading[ae];if(X)return X;try{return await(this._loading[ae]=U(ae))}finally{delete this._loading[ae]}}}addSchema(D,H,U,L=this.opts.validateSchema){if(Array.isArray(D)){for(const se of D)this.addSchema(se,void 0,U,L);return this}let G;if(typeof D=="object"){const{schemaId:se}=this.opts;if(G=D[se],G!==void 0&&typeof G!="string")throw new Error(`schema ${se} must be string`)}return H=(0,d.normalizeId)(H||G),this._checkUnique(H),this.schemas[H]=this._addSchema(D,U,H,L,!0),this}addMetaSchema(D,H,U=this.opts.validateSchema){return this.addSchema(D,H,!0,U),this}validateSchema(D,H){if(typeof D=="boolean")return!0;let U;if(U=D.$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 L=this.validate(U,D);if(!L&&H){const G="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(G);else throw new Error(G)}return L}getSchema(D){let H;for(;typeof(H=C.call(this,D))=="string";)D=H;if(H===void 0){const{schemaId:U}=this.opts,L=new f.SchemaEnv({schema:{},schemaId:U});if(H=f.resolveSchema.call(this,L,D),!H)return;this.refs[D]=H}return H.validate||this._compileSchemaEnv(H)}removeSchema(D){if(D instanceof RegExp)return this._removeAllSchemas(this.schemas,D),this._removeAllSchemas(this.refs,D),this;switch(typeof D){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const H=C.call(this,D);return typeof H=="object"&&this._cache.delete(H.schema),delete this.schemas[D],delete this.refs[D],this}case"object":{const H=D;this._cache.delete(H);let U=D[this.opts.schemaId];return U&&(U=(0,d.normalizeId)(U),delete this.schemas[U],delete this.refs[U]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(D){for(const H of D)this.addKeyword(H);return this}addKeyword(D,H){let U;if(typeof D=="string")U=D,typeof H=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),H.keyword=U);else if(typeof D=="object"&&H===void 0){if(H=D,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(J.call(this,U,H),!H)return(0,y.eachItem)(U,G=>ee.call(this,G)),this;Q.call(this,H);const L={...H,type:(0,m.getJSONTypes)(H.type),schemaType:(0,m.getJSONTypes)(H.schemaType)};return(0,y.eachItem)(U,L.type.length===0?G=>ee.call(this,G,L):G=>L.type.forEach(se=>ee.call(this,G,L,se))),this}getKeyword(D){const H=this.RULES.all[D];return typeof H=="object"?H.definition:!!H}removeKeyword(D){const{RULES:H}=this;delete H.keywords[D],delete H.all[D];for(const U of H.rules){const L=U.rules.findIndex(G=>G.keyword===D);L>=0&&U.rules.splice(L,1)}return this}addFormat(D,H){return typeof H=="string"&&(H=new RegExp(H)),this.formats[D]=H,this}errorsText(D=this.errors,{separator:H=", ",dataVar:U="data"}={}){return!D||D.length===0?"No errors":D.map(L=>`${U}${L.instancePath} ${L.message}`).reduce((L,G)=>L+H+G)}$dataMetaSchema(D,H){const U=this.RULES.all;D=JSON.parse(JSON.stringify(D));for(const L of H){const G=L.split("/").slice(1);let se=D;for(const Y of G)se=se[Y];for(const Y in U){const F=U[Y];if(typeof F!="object")continue;const{$data:le}=F.definition,ae=se[Y];le&&ae&&(se[Y]=I(ae))}}return D}_removeAllSchemas(D,H){for(const U in D){const L=D[U];(!H||H.test(U))&&(typeof L=="string"?delete D[U]:L&&!L.meta&&(this._cache.delete(L.schema),delete D[U]))}}_addSchema(D,H,U,L=this.opts.validateSchema,G=this.opts.addUsedSchema){let se;const{schemaId:Y}=this.opts;if(typeof D=="object")se=D[Y];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof D!="boolean")throw new Error("schema must be object or boolean")}let F=this._cache.get(D);if(F!==void 0)return F;U=(0,d.normalizeId)(se||U);const le=d.getSchemaRefs.call(this,D,U);return F=new f.SchemaEnv({schema:D,schemaId:Y,meta:H,baseId:U,localRefs:le}),this._cache.set(F.schema,F),G&&!U.startsWith("#")&&(U&&this._checkUnique(U),this.refs[U]=F),L&&this.validateSchema(D,!0),F}_checkUnique(D){if(this.schemas[D]||this.refs[D])throw new Error(`schema with key or id "${D}" already exists`)}_compileSchemaEnv(D){if(D.meta?this._compileMetaSchema(D):f.compileSchema.call(this,D),!D.validate)throw new Error("ajv implementation error");return D.validate}_compileMetaSchema(D){const H=this.opts;this.opts=this._metaOpts;try{f.compileSchema.call(this,D)}finally{this.opts=H}}}k.ValidationError=r.default,k.MissingRefError=o.default,e.default=k;function A(P,D,H,U="error"){for(const L in P){const G=L;G in D&&this.logger[U](`${H}: option ${L}. ${P[G]}`)}}function C(P){return P=(0,d.normalizeId)(P),this.schemas[P]||this.refs[P]}function N(){const P=this.opts.schemas;if(P)if(Array.isArray(P))this.addSchema(P);else for(const D in P)this.addSchema(P[D],D)}function j(){for(const P in this.opts.formats){const D=this.opts.formats[P];D&&this.addFormat(P,D)}}function M(P){if(Array.isArray(P)){this.addVocabulary(P);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const D in P){const H=P[D];H.keyword||(H.keyword=D),this.addKeyword(H)}}function O(){const P={...this.opts};for(const D of R)delete P[D];return P}const B={log(){},warn(){},error(){}};function q(P){if(P===!1)return B;if(P===void 0)return console;if(P.log&&P.warn&&P.error)return P;throw new Error("logger must implement log, warn and error methods")}const V=/^[a-z_$][a-z0-9_$:-]*$/i;function J(P,D){const{RULES:H}=this;if((0,y.eachItem)(P,U=>{if(H.keywords[U])throw new Error(`Keyword ${U} is already defined`);if(!V.test(U))throw new Error(`Keyword ${U} has invalid name`)}),!!D&&D.$data&&!("code"in D||"validate"in D))throw new Error('$data keyword must have "code" or "validate" function')}function ee(P,D,H){var U;const L=D==null?void 0:D.post;if(H&&L)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:G}=this;let se=L?G.post:G.rules.find(({type:F})=>F===H);if(se||(se={type:H,rules:[]},G.rules.push(se)),G.keywords[P]=!0,!D)return;const Y={keyword:P,definition:{...D,type:(0,m.getJSONTypes)(D.type),schemaType:(0,m.getJSONTypes)(D.schemaType)}};D.before?W.call(this,se,Y,D.before):se.rules.push(Y),G.all[P]=Y,(U=D.implements)===null||U===void 0||U.forEach(F=>this.addKeyword(F))}function W(P,D,H){const U=P.rules.findIndex(L=>L.keyword===H);U>=0?P.rules.splice(U,0,D):(P.rules.push(D),this.logger.warn(`rule ${H} is not defined`))}function Q(P){let{metaSchema:D}=P;D!==void 0&&(P.$data&&this.opts.$data&&(D=I(D)),P.validateSchema=this.compile(D,!0))}const ie={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function I(P){return{anyOf:[P,ie]}}})(Cm)),Cm}var Pu={},Bu={},Hu={},yS;function lM(){if(yS)return Hu;yS=1,Object.defineProperty(Hu,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return Hu.default=e,Hu}var br={},bS;function yg(){if(bS)return br;bS=1,Object.defineProperty(br,"__esModule",{value:!0}),br.callRef=br.getValidate=void 0;const e=Nh(),t=tn(),i=ft(),r=en(),o=Mh(),c=yt(),f={keyword:"$ref",schemaType:"string",code(m){const{gen:y,schema:v,it:S}=m,{baseId:w,schemaEnv:R,validateName:x,opts:g,self:b}=S,{root:p}=R;if((v==="#"||v==="#/")&&w===p.baseId)return k();const _=o.resolveRef.call(b,p,w,v);if(_===void 0)throw new e.default(S.opts.uriResolver,w,v);if(_ instanceof o.SchemaEnv)return A(_);return C(_);function k(){if(R===p)return d(m,x,R,R.$async);const N=y.scopeValue("root",{ref:p});return d(m,(0,i._)`${N}.validate`,p,p.$async)}function A(N){const j=l(m,N);d(m,j,N,N.$async)}function C(N){const j=y.scopeValue("schema",g.code.source===!0?{ref:N,code:(0,i.stringify)(N)}:{ref:N}),M=y.name("valid"),O=m.subschema({schema:N,dataTypes:[],schemaPath:i.nil,topSchemaRef:j,errSchemaPath:v},M);m.mergeEvaluated(O),m.ok(M)}}};function l(m,y){const{gen:v}=m;return y.validate?v.scopeValue("validate",{ref:y.validate}):(0,i._)`${v.scopeValue("wrapper",{ref:y})}.validate`}br.getValidate=l;function d(m,y,v,S){const{gen:w,it:R}=m,{allErrors:x,schemaEnv:g,opts:b}=R,p=b.passContext?r.default.this:i.nil;S?_():k();function _(){if(!g.$async)throw new Error("async schema referenced by sync schema");const N=w.let("valid");w.try(()=>{w.code((0,i._)`await ${(0,t.callValidateCode)(m,y,p)}`),C(y),x||w.assign(N,!0)},j=>{w.if((0,i._)`!(${j} instanceof ${R.ValidationError})`,()=>w.throw(j)),A(j),x||w.assign(N,!1)}),m.ok(N)}function k(){m.result((0,t.callValidateCode)(m,y,p),()=>C(y),()=>A(y))}function A(N){const j=(0,i._)`${N}.errors`;w.assign(r.default.vErrors,(0,i._)`${r.default.vErrors} === null ? ${j} : ${r.default.vErrors}.concat(${j})`),w.assign(r.default.errors,(0,i._)`${r.default.vErrors}.length`)}function C(N){var j;if(!R.opts.unevaluated)return;const M=(j=v==null?void 0:v.validate)===null||j===void 0?void 0:j.evaluated;if(R.props!==!0)if(M&&!M.dynamicProps)M.props!==void 0&&(R.props=c.mergeEvaluated.props(w,M.props,R.props));else{const O=w.var("props",(0,i._)`${N}.evaluated.props`);R.props=c.mergeEvaluated.props(w,O,R.props,i.Name)}if(R.items!==!0)if(M&&!M.dynamicItems)M.items!==void 0&&(R.items=c.mergeEvaluated.items(w,M.items,R.items));else{const O=w.var("items",(0,i._)`${N}.evaluated.items`);R.items=c.mergeEvaluated.items(w,O,R.items,i.Name)}}}return br.callRef=d,br.default=f,br}var SS;function cM(){if(SS)return Bu;SS=1,Object.defineProperty(Bu,"__esModule",{value:!0});const e=lM(),t=yg(),i=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return Bu.default=i,Bu}var zu={},Uu={},wS;function uM(){if(wS)return Uu;wS=1,Object.defineProperty(Uu,"__esModule",{value:!0});const e=ft(),t=e.operators,i={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:f})=>(0,e.str)`must be ${i[c].okStr} ${f}`,params:({keyword:c,schemaCode:f})=>(0,e._)`{comparison: ${i[c].okStr}, limit: ${f}}`},o={keyword:Object.keys(i),type:"number",schemaType:"number",$data:!0,error:r,code(c){const{keyword:f,data:l,schemaCode:d}=c;c.fail$data((0,e._)`${l} ${i[f].fail} ${d} || isNaN(${l})`)}};return Uu.default=o,Uu}var qu={},xS;function dM(){if(xS)return qu;xS=1,Object.defineProperty(qu,"__esModule",{value:!0});const e=ft(),i={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:f,it:l}=r,d=l.opts.multipleOfPrecision,m=o.let("res"),y=d?(0,e._)`Math.abs(Math.round(${m}) - ${m}) > 1e-${d}`:(0,e._)`${m} !== parseInt(${m})`;r.fail$data((0,e._)`(${f} === 0 || (${m} = ${c}/${f}, ${y}))`)}};return qu.default=i,qu}var Fu={},Vu={},CS;function hM(){if(CS)return Vu;CS=1,Object.defineProperty(Vu,"__esModule",{value:!0});function e(t){const i=t.length;let r=0,o=0,c;for(;o<i;)r++,c=t.charCodeAt(o++),c>=55296&&c<=56319&&o<i&&(c=t.charCodeAt(o),(c&64512)===56320&&o++);return r}return Vu.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',Vu}var ES;function fM(){if(ES)return Fu;ES=1,Object.defineProperty(Fu,"__esModule",{value:!0});const e=ft(),t=yt(),i=hM(),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:c,schemaCode:f}){const l=c==="maxLength"?"more":"fewer";return(0,e.str)`must NOT have ${l} than ${f} characters`},params:({schemaCode:c})=>(0,e._)`{limit: ${c}}`},code(c){const{keyword:f,data:l,schemaCode:d,it:m}=c,y=f==="maxLength"?e.operators.GT:e.operators.LT,v=m.opts.unicode===!1?(0,e._)`${l}.length`:(0,e._)`${(0,t.useFunc)(c.gen,i.default)}(${l})`;c.fail$data((0,e._)`${v} ${y} ${d}`)}};return Fu.default=o,Fu}var Wu={},kS;function pM(){if(kS)return Wu;kS=1,Object.defineProperty(Wu,"__esModule",{value:!0});const e=tn(),t=yt(),i=ft(),o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:c})=>(0,i.str)`must match pattern "${c}"`,params:({schemaCode:c})=>(0,i._)`{pattern: ${c}}`},code(c){const{gen:f,data:l,$data:d,schema:m,schemaCode:y,it:v}=c,S=v.opts.unicodeRegExp?"u":"";if(d){const{regExp:w}=v.opts.code,R=w.code==="new RegExp"?(0,i._)`new RegExp`:(0,t.useFunc)(f,w),x=f.let("valid");f.try(()=>f.assign(x,(0,i._)`${R}(${y}, ${S}).test(${l})`),()=>f.assign(x,!1)),c.fail$data((0,i._)`!${x}`)}else{const w=(0,e.usePattern)(c,m);c.fail$data((0,i._)`!${w}.test(${l})`)}}};return Wu.default=o,Wu}var Gu={},AS;function mM(){if(AS)return Gu;AS=1,Object.defineProperty(Gu,"__esModule",{value:!0});const e=ft(),i={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:f}=r,l=o==="maxProperties"?e.operators.GT:e.operators.LT;r.fail$data((0,e._)`Object.keys(${c}).length ${l} ${f}`)}};return Gu.default=i,Gu}var Ku={},jS;function vM(){if(jS)return Ku;jS=1,Object.defineProperty(Ku,"__esModule",{value:!0});const e=tn(),t=ft(),i=yt(),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:f,schema:l,schemaCode:d,data:m,$data:y,it:v}=c,{opts:S}=v;if(!y&&l.length===0)return;const w=l.length>=S.loopRequired;if(v.allErrors?R():x(),S.strictRequired){const p=c.parentSchema.properties,{definedProperties:_}=c.it;for(const k of l)if((p==null?void 0:p[k])===void 0&&!_.has(k)){const A=v.schemaEnv.baseId+v.errSchemaPath,C=`required property "${k}" is not defined at "${A}" (strictRequired)`;(0,i.checkStrictMode)(v,C,v.opts.strictRequired)}}function R(){if(w||y)c.block$data(t.nil,g);else for(const p of l)(0,e.checkReportMissingProp)(c,p)}function x(){const p=f.let("missing");if(w||y){const _=f.let("valid",!0);c.block$data(_,()=>b(p,_)),c.ok(_)}else f.if((0,e.checkMissingProp)(c,l,p)),(0,e.reportMissingProp)(c,p),f.else()}function g(){f.forOf("prop",d,p=>{c.setParams({missingProperty:p}),f.if((0,e.noPropertyInData)(f,m,p,S.ownProperties),()=>c.error())})}function b(p,_){c.setParams({missingProperty:p}),f.forOf(p,d,()=>{f.assign(_,(0,e.propertyInData)(f,m,p,S.ownProperties)),f.if((0,t.not)(_),()=>{c.error(),f.break()})},t.nil)}}};return Ku.default=o,Ku}var Yu={},RS;function gM(){if(RS)return Yu;RS=1,Object.defineProperty(Yu,"__esModule",{value:!0});const e=ft(),i={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:f}=r,l=o==="maxItems"?e.operators.GT:e.operators.LT;r.fail$data((0,e._)`${c}.length ${l} ${f}`)}};return Yu.default=i,Yu}var Xu={},Ju={},TS;function bg(){if(TS)return Ju;TS=1,Object.defineProperty(Ju,"__esModule",{value:!0});const e=o2();return e.code='require("ajv/dist/runtime/equal").default',Ju.default=e,Ju}var NS;function _M(){if(NS)return Xu;NS=1,Object.defineProperty(Xu,"__esModule",{value:!0});const e=_h(),t=ft(),i=yt(),r=bg(),c={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:f,j:l}})=>(0,t.str)`must NOT have duplicate items (items ## ${l} and ${f} are identical)`,params:({params:{i:f,j:l}})=>(0,t._)`{i: ${f}, j: ${l}}`},code(f){const{gen:l,data:d,$data:m,schema:y,parentSchema:v,schemaCode:S,it:w}=f;if(!m&&!y)return;const R=l.let("valid"),x=v.items?(0,e.getSchemaTypes)(v.items):[];f.block$data(R,g,(0,t._)`${S} === false`),f.ok(R);function g(){const k=l.let("i",(0,t._)`${d}.length`),A=l.let("j");f.setParams({i:k,j:A}),l.assign(R,!0),l.if((0,t._)`${k} > 1`,()=>(b()?p:_)(k,A))}function b(){return x.length>0&&!x.some(k=>k==="object"||k==="array")}function p(k,A){const C=l.name("item"),N=(0,e.checkDataTypes)(x,C,w.opts.strictNumbers,e.DataType.Wrong),j=l.const("indices",(0,t._)`{}`);l.for((0,t._)`;${k}--;`,()=>{l.let(C,(0,t._)`${d}[${k}]`),l.if(N,(0,t._)`continue`),x.length>1&&l.if((0,t._)`typeof ${C} == "string"`,(0,t._)`${C} += "_"`),l.if((0,t._)`typeof ${j}[${C}] == "number"`,()=>{l.assign(A,(0,t._)`${j}[${C}]`),f.error(),l.assign(R,!1).break()}).code((0,t._)`${j}[${C}] = ${k}`)})}function _(k,A){const C=(0,i.useFunc)(l,r.default),N=l.name("outer");l.label(N).for((0,t._)`;${k}--;`,()=>l.for((0,t._)`${A} = ${k}; ${A}--;`,()=>l.if((0,t._)`${C}(${d}[${k}], ${d}[${A}])`,()=>{f.error(),l.assign(R,!1).break(N)})))}}};return Xu.default=c,Xu}var Zu={},MS;function yM(){if(MS)return Zu;MS=1,Object.defineProperty(Zu,"__esModule",{value:!0});const e=ft(),t=yt(),i=bg(),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:c})=>(0,e._)`{allowedValue: ${c}}`},code(c){const{gen:f,data:l,$data:d,schemaCode:m,schema:y}=c;d||y&&typeof y=="object"?c.fail$data((0,e._)`!${(0,t.useFunc)(f,i.default)}(${l}, ${m})`):c.fail((0,e._)`${y} !== ${l}`)}};return Zu.default=o,Zu}var Qu={},DS;function bM(){if(DS)return Qu;DS=1,Object.defineProperty(Qu,"__esModule",{value:!0});const e=ft(),t=yt(),i=bg(),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:f,data:l,$data:d,schema:m,schemaCode:y,it:v}=c;if(!d&&m.length===0)throw new Error("enum must have non-empty array");const S=m.length>=v.opts.loopEnum;let w;const R=()=>w??(w=(0,t.useFunc)(f,i.default));let x;if(S||d)x=f.let("valid"),c.block$data(x,g);else{if(!Array.isArray(m))throw new Error("ajv implementation error");const p=f.const("vSchema",y);x=(0,e.or)(...m.map((_,k)=>b(p,k)))}c.pass(x);function g(){f.assign(x,!1),f.forOf("v",y,p=>f.if((0,e._)`${R()}(${l}, ${p})`,()=>f.assign(x,!0).break()))}function b(p,_){const k=m[_];return typeof k=="object"&&k!==null?(0,e._)`${R()}(${l}, ${p}[${_}])`:(0,e._)`${l} === ${k}`}}};return Qu.default=o,Qu}var OS;function SM(){if(OS)return zu;OS=1,Object.defineProperty(zu,"__esModule",{value:!0});const e=uM(),t=dM(),i=fM(),r=pM(),o=mM(),c=vM(),f=gM(),l=_M(),d=yM(),m=bM(),y=[e.default,t.default,i.default,r.default,o.default,c.default,f.default,l.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},d.default,m.default];return zu.default=y,zu}var ed={},Qa={},$S;function c2(){if($S)return Qa;$S=1,Object.defineProperty(Qa,"__esModule",{value:!0}),Qa.validateAdditionalItems=void 0;const e=ft(),t=yt(),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:f,it:l}=c,{items:d}=f;if(!Array.isArray(d)){(0,t.checkStrictMode)(l,'"additionalItems" is ignored when "items" is not an array of schemas');return}o(c,d)}};function o(c,f){const{gen:l,schema:d,data:m,keyword:y,it:v}=c;v.items=!0;const S=l.const("len",(0,e._)`${m}.length`);if(d===!1)c.setParams({len:f.length}),c.pass((0,e._)`${S} <= ${f.length}`);else if(typeof d=="object"&&!(0,t.alwaysValidSchema)(v,d)){const R=l.var("valid",(0,e._)`${S} <= ${f.length}`);l.if((0,e.not)(R),()=>w(R)),c.ok(R)}function w(R){l.forRange("i",f.length,S,x=>{c.subschema({keyword:y,dataProp:x,dataPropType:t.Type.Num},R),v.allErrors||l.if((0,e.not)(R),()=>l.break())})}}return Qa.validateAdditionalItems=o,Qa.default=r,Qa}var td={},eo={},LS;function u2(){if(LS)return eo;LS=1,Object.defineProperty(eo,"__esModule",{value:!0}),eo.validateTuple=void 0;const e=ft(),t=yt(),i=tn(),r={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(c){const{schema:f,it:l}=c;if(Array.isArray(f))return o(c,"additionalItems",f);l.items=!0,!(0,t.alwaysValidSchema)(l,f)&&c.ok((0,i.validateArray)(c))}};function o(c,f,l=c.schema){const{gen:d,parentSchema:m,data:y,keyword:v,it:S}=c;x(m),S.opts.unevaluated&&l.length&&S.items!==!0&&(S.items=t.mergeEvaluated.items(d,l.length,S.items));const w=d.name("valid"),R=d.const("len",(0,e._)`${y}.length`);l.forEach((g,b)=>{(0,t.alwaysValidSchema)(S,g)||(d.if((0,e._)`${R} > ${b}`,()=>c.subschema({keyword:v,schemaProp:b,dataProp:b},w)),c.ok(w))});function x(g){const{opts:b,errSchemaPath:p}=S,_=l.length,k=_===g.minItems&&(_===g.maxItems||g[f]===!1);if(b.strictTuples&&!k){const A=`"${v}" is ${_}-tuple, but minItems or maxItems/${f} are not specified or different at path "${p}"`;(0,t.checkStrictMode)(S,A,b.strictTuples)}}}return eo.validateTuple=o,eo.default=r,eo}var IS;function wM(){if(IS)return td;IS=1,Object.defineProperty(td,"__esModule",{value:!0});const e=u2(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:i=>(0,e.validateTuple)(i,"items")};return td.default=t,td}var sd={},PS;function xM(){if(PS)return sd;PS=1,Object.defineProperty(sd,"__esModule",{value:!0});const e=ft(),t=yt(),i=tn(),r=c2(),c={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:f}})=>(0,e.str)`must NOT have more than ${f} items`,params:({params:{len:f}})=>(0,e._)`{limit: ${f}}`},code(f){const{schema:l,parentSchema:d,it:m}=f,{prefixItems:y}=d;m.items=!0,!(0,t.alwaysValidSchema)(m,l)&&(y?(0,r.validateAdditionalItems)(f,y):f.ok((0,i.validateArray)(f)))}};return sd.default=c,sd}var id={},BS;function CM(){if(BS)return id;BS=1,Object.defineProperty(id,"__esModule",{value:!0});const e=ft(),t=yt(),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:f,parentSchema:l,data:d,it:m}=o;let y,v;const{minContains:S,maxContains:w}=l;m.opts.next?(y=S===void 0?1:S,v=w):y=1;const R=c.const("len",(0,e._)`${d}.length`);if(o.setParams({min:y,max:v}),v===void 0&&y===0){(0,t.checkStrictMode)(m,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(v!==void 0&&y>v){(0,t.checkStrictMode)(m,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,t.alwaysValidSchema)(m,f)){let _=(0,e._)`${R} >= ${y}`;v!==void 0&&(_=(0,e._)`${_} && ${R} <= ${v}`),o.pass(_);return}m.items=!0;const x=c.name("valid");v===void 0&&y===1?b(x,()=>c.if(x,()=>c.break())):y===0?(c.let(x,!0),v!==void 0&&c.if((0,e._)`${d}.length > 0`,g)):(c.let(x,!1),g()),o.result(x,()=>o.reset());function g(){const _=c.name("_valid"),k=c.let("count",0);b(_,()=>c.if(_,()=>p(k)))}function b(_,k){c.forRange("i",0,R,A=>{o.subschema({keyword:"contains",dataProp:A,dataPropType:t.Type.Num,compositeRule:!0},_),k()})}function p(_){c.code((0,e._)`${_}++`),v===void 0?c.if((0,e._)`${_} >= ${y}`,()=>c.assign(x,!0).break()):(c.if((0,e._)`${_} > ${v}`,()=>c.assign(x,!1).break()),y===1?c.assign(x,!0):c.if((0,e._)`${_} >= ${y}`,()=>c.assign(x,!0)))}}};return id.default=r,id}var Dm={},HS;function Sg(){return HS||(HS=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=ft(),i=yt(),r=tn();e.error={message:({params:{property:d,depsCount:m,deps:y}})=>{const v=m===1?"property":"properties";return(0,t.str)`must have ${v} ${y} when property ${d} is present`},params:({params:{property:d,depsCount:m,deps:y,missingProperty:v}})=>(0,t._)`{property: ${d},
476
+ missingProperty: ${v},
477
+ depsCount: ${m},
478
+ deps: ${y}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(d){const[m,y]=c(d);f(d,m),l(d,y)}};function c({schema:d}){const m={},y={};for(const v in d){if(v==="__proto__")continue;const S=Array.isArray(d[v])?m:y;S[v]=d[v]}return[m,y]}function f(d,m=d.schema){const{gen:y,data:v,it:S}=d;if(Object.keys(m).length===0)return;const w=y.let("missing");for(const R in m){const x=m[R];if(x.length===0)continue;const g=(0,r.propertyInData)(y,v,R,S.opts.ownProperties);d.setParams({property:R,depsCount:x.length,deps:x.join(", ")}),S.allErrors?y.if(g,()=>{for(const b of x)(0,r.checkReportMissingProp)(d,b)}):(y.if((0,t._)`${g} && (${(0,r.checkMissingProp)(d,x,w)})`),(0,r.reportMissingProp)(d,w),y.else())}}e.validatePropertyDeps=f;function l(d,m=d.schema){const{gen:y,data:v,keyword:S,it:w}=d,R=y.name("valid");for(const x in m)(0,i.alwaysValidSchema)(w,m[x])||(y.if((0,r.propertyInData)(y,v,x,w.opts.ownProperties),()=>{const g=d.subschema({keyword:S,schemaProp:x},R);d.mergeValidEvaluated(g,R)},()=>y.var(R,!0)),d.ok(R))}e.validateSchemaDeps=l,e.default=o})(Dm)),Dm}var nd={},zS;function EM(){if(zS)return nd;zS=1,Object.defineProperty(nd,"__esModule",{value:!0});const e=ft(),t=yt(),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:f,data:l,it:d}=o;if((0,t.alwaysValidSchema)(d,f))return;const m=c.name("valid");c.forIn("key",l,y=>{o.setParams({propertyName:y}),o.subschema({keyword:"propertyNames",data:y,dataTypes:["string"],propertyName:y,compositeRule:!0},m),c.if((0,e.not)(m),()=>{o.error(!0),d.allErrors||c.break()})}),o.ok(m)}};return nd.default=r,nd}var rd={},US;function d2(){if(US)return rd;US=1,Object.defineProperty(rd,"__esModule",{value:!0});const e=tn(),t=ft(),i=en(),r=yt(),c={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:f})=>(0,t._)`{additionalProperty: ${f.additionalProperty}}`},code(f){const{gen:l,schema:d,parentSchema:m,data:y,errsCount:v,it:S}=f;if(!v)throw new Error("ajv implementation error");const{allErrors:w,opts:R}=S;if(S.props=!0,R.removeAdditional!=="all"&&(0,r.alwaysValidSchema)(S,d))return;const x=(0,e.allSchemaProperties)(m.properties),g=(0,e.allSchemaProperties)(m.patternProperties);b(),f.ok((0,t._)`${v} === ${i.default.errors}`);function b(){l.forIn("key",y,C=>{!x.length&&!g.length?k(C):l.if(p(C),()=>k(C))})}function p(C){let N;if(x.length>8){const j=(0,r.schemaRefOrVal)(S,m.properties,"properties");N=(0,e.isOwnProperty)(l,j,C)}else x.length?N=(0,t.or)(...x.map(j=>(0,t._)`${C} === ${j}`)):N=t.nil;return g.length&&(N=(0,t.or)(N,...g.map(j=>(0,t._)`${(0,e.usePattern)(f,j)}.test(${C})`))),(0,t.not)(N)}function _(C){l.code((0,t._)`delete ${y}[${C}]`)}function k(C){if(R.removeAdditional==="all"||R.removeAdditional&&d===!1){_(C);return}if(d===!1){f.setParams({additionalProperty:C}),f.error(),w||l.break();return}if(typeof d=="object"&&!(0,r.alwaysValidSchema)(S,d)){const N=l.name("valid");R.removeAdditional==="failing"?(A(C,N,!1),l.if((0,t.not)(N),()=>{f.reset(),_(C)})):(A(C,N),w||l.if((0,t.not)(N),()=>l.break()))}}function A(C,N,j){const M={keyword:"additionalProperties",dataProp:C,dataPropType:r.Type.Str};j===!1&&Object.assign(M,{compositeRule:!0,createErrors:!1,allErrors:!1}),f.subschema(M,N)}}};return rd.default=c,rd}var ad={},qS;function kM(){if(qS)return ad;qS=1,Object.defineProperty(ad,"__esModule",{value:!0});const e=Th(),t=tn(),i=yt(),r=d2(),o={keyword:"properties",type:"object",schemaType:"object",code(c){const{gen:f,schema:l,parentSchema:d,data:m,it:y}=c;y.opts.removeAdditional==="all"&&d.additionalProperties===void 0&&r.default.code(new e.KeywordCxt(y,r.default,"additionalProperties"));const v=(0,t.allSchemaProperties)(l);for(const g of v)y.definedProperties.add(g);y.opts.unevaluated&&v.length&&y.props!==!0&&(y.props=i.mergeEvaluated.props(f,(0,i.toHash)(v),y.props));const S=v.filter(g=>!(0,i.alwaysValidSchema)(y,l[g]));if(S.length===0)return;const w=f.name("valid");for(const g of S)R(g)?x(g):(f.if((0,t.propertyInData)(f,m,g,y.opts.ownProperties)),x(g),y.allErrors||f.else().var(w,!0),f.endIf()),c.it.definedProperties.add(g),c.ok(w);function R(g){return y.opts.useDefaults&&!y.compositeRule&&l[g].default!==void 0}function x(g){c.subschema({keyword:"properties",schemaProp:g,dataProp:g},w)}}};return ad.default=o,ad}var od={},FS;function AM(){if(FS)return od;FS=1,Object.defineProperty(od,"__esModule",{value:!0});const e=tn(),t=ft(),i=yt(),r=yt(),o={keyword:"patternProperties",type:"object",schemaType:"object",code(c){const{gen:f,schema:l,data:d,parentSchema:m,it:y}=c,{opts:v}=y,S=(0,e.allSchemaProperties)(l),w=S.filter(k=>(0,i.alwaysValidSchema)(y,l[k]));if(S.length===0||w.length===S.length&&(!y.opts.unevaluated||y.props===!0))return;const R=v.strictSchema&&!v.allowMatchingProperties&&m.properties,x=f.name("valid");y.props!==!0&&!(y.props instanceof t.Name)&&(y.props=(0,r.evaluatedPropsToName)(f,y.props));const{props:g}=y;b();function b(){for(const k of S)R&&p(k),y.allErrors?_(k):(f.var(x,!0),_(k),f.if(x))}function p(k){for(const A in R)new RegExp(k).test(A)&&(0,i.checkStrictMode)(y,`property ${A} matches pattern ${k} (use allowMatchingProperties)`)}function _(k){f.forIn("key",d,A=>{f.if((0,t._)`${(0,e.usePattern)(c,k)}.test(${A})`,()=>{const C=w.includes(k);C||c.subschema({keyword:"patternProperties",schemaProp:k,dataProp:A,dataPropType:r.Type.Str},x),y.opts.unevaluated&&g!==!0?f.assign((0,t._)`${g}[${A}]`,!0):!C&&!y.allErrors&&f.if((0,t.not)(x),()=>f.break())})})}}};return od.default=o,od}var ld={},VS;function jM(){if(VS)return ld;VS=1,Object.defineProperty(ld,"__esModule",{value:!0});const e=yt(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(i){const{gen:r,schema:o,it:c}=i;if((0,e.alwaysValidSchema)(c,o)){i.fail();return}const f=r.name("valid");i.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},f),i.failResult(f,()=>i.reset(),()=>i.error())},error:{message:"must NOT be valid"}};return ld.default=t,ld}var cd={},WS;function RM(){if(WS)return cd;WS=1,Object.defineProperty(cd,"__esModule",{value:!0});const t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:tn().validateUnion,error:{message:"must match a schema in anyOf"}};return cd.default=t,cd}var ud={},GS;function TM(){if(GS)return ud;GS=1,Object.defineProperty(ud,"__esModule",{value:!0});const e=ft(),t=yt(),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:f,parentSchema:l,it:d}=o;if(!Array.isArray(f))throw new Error("ajv implementation error");if(d.opts.discriminator&&l.discriminator)return;const m=f,y=c.let("valid",!1),v=c.let("passing",null),S=c.name("_valid");o.setParams({passing:v}),c.block(w),o.result(y,()=>o.reset(),()=>o.error(!0));function w(){m.forEach((R,x)=>{let g;(0,t.alwaysValidSchema)(d,R)?c.var(S,!0):g=o.subschema({keyword:"oneOf",schemaProp:x,compositeRule:!0},S),x>0&&c.if((0,e._)`${S} && ${y}`).assign(y,!1).assign(v,(0,e._)`[${v}, ${x}]`).else(),c.if(S,()=>{c.assign(y,!0),c.assign(v,x),g&&o.mergeEvaluated(g,e.Name)})})}}};return ud.default=r,ud}var dd={},KS;function NM(){if(KS)return dd;KS=1,Object.defineProperty(dd,"__esModule",{value:!0});const e=yt(),t={keyword:"allOf",schemaType:"array",code(i){const{gen:r,schema:o,it:c}=i;if(!Array.isArray(o))throw new Error("ajv implementation error");const f=r.name("valid");o.forEach((l,d)=>{if((0,e.alwaysValidSchema)(c,l))return;const m=i.subschema({keyword:"allOf",schemaProp:d},f);i.ok(f),i.mergeEvaluated(m)})}};return dd.default=t,dd}var hd={},YS;function MM(){if(YS)return hd;YS=1,Object.defineProperty(hd,"__esModule",{value:!0});const e=ft(),t=yt(),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:f,parentSchema:l,it:d}=c;l.then===void 0&&l.else===void 0&&(0,t.checkStrictMode)(d,'"if" without "then" and "else" is ignored');const m=o(d,"then"),y=o(d,"else");if(!m&&!y)return;const v=f.let("valid",!0),S=f.name("_valid");if(w(),c.reset(),m&&y){const x=f.let("ifClause");c.setParams({ifClause:x}),f.if(S,R("then",x),R("else",x))}else m?f.if(S,R("then")):f.if((0,e.not)(S),R("else"));c.pass(v,()=>c.error(!0));function w(){const x=c.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},S);c.mergeEvaluated(x)}function R(x,g){return()=>{const b=c.subschema({keyword:x},S);f.assign(v,S),c.mergeValidEvaluated(b,v),g?f.assign(g,(0,e._)`${x}`):c.setParams({ifClause:x})}}}};function o(c,f){const l=c.schema[f];return l!==void 0&&!(0,t.alwaysValidSchema)(c,l)}return hd.default=r,hd}var fd={},XS;function DM(){if(XS)return fd;XS=1,Object.defineProperty(fd,"__esModule",{value:!0});const e=yt(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:i,parentSchema:r,it:o}){r.if===void 0&&(0,e.checkStrictMode)(o,`"${i}" without "if" is ignored`)}};return fd.default=t,fd}var JS;function OM(){if(JS)return ed;JS=1,Object.defineProperty(ed,"__esModule",{value:!0});const e=c2(),t=wM(),i=u2(),r=xM(),o=CM(),c=Sg(),f=EM(),l=d2(),d=kM(),m=AM(),y=jM(),v=RM(),S=TM(),w=NM(),R=MM(),x=DM();function g(b=!1){const p=[y.default,v.default,S.default,w.default,R.default,x.default,f.default,l.default,c.default,d.default,m.default];return b?p.push(t.default,r.default):p.push(e.default,i.default),p.push(o.default),p}return ed.default=g,ed}var pd={},to={},ZS;function h2(){if(ZS)return to;ZS=1,Object.defineProperty(to,"__esModule",{value:!0}),to.dynamicAnchor=void 0;const e=ft(),t=en(),i=Mh(),r=yg(),o={keyword:"$dynamicAnchor",schemaType:"string",code:l=>c(l,l.schema)};function c(l,d){const{gen:m,it:y}=l;y.schemaEnv.root.dynamicAnchors[d]=!0;const v=(0,e._)`${t.default.dynamicAnchors}${(0,e.getProperty)(d)}`,S=y.errSchemaPath==="#"?y.validateName:f(l);m.if((0,e._)`!${v}`,()=>m.assign(v,S))}to.dynamicAnchor=c;function f(l){const{schemaEnv:d,schema:m,self:y}=l.it,{root:v,baseId:S,localRefs:w,meta:R}=d.root,{schemaId:x}=y.opts,g=new i.SchemaEnv({schema:m,schemaId:x,root:v,baseId:S,localRefs:w,meta:R});return i.compileSchema.call(y,g),(0,r.getValidate)(l,g)}return to.default=o,to}var so={},QS;function f2(){if(QS)return so;QS=1,Object.defineProperty(so,"__esModule",{value:!0}),so.dynamicRef=void 0;const e=ft(),t=en(),i=yg(),r={keyword:"$dynamicRef",schemaType:"string",code:c=>o(c,c.schema)};function o(c,f){const{gen:l,keyword:d,it:m}=c;if(f[0]!=="#")throw new Error(`"${d}" only supports hash fragment reference`);const y=f.slice(1);if(m.allErrors)v();else{const w=l.let("valid",!1);v(w),c.ok(w)}function v(w){if(m.schemaEnv.root.dynamicAnchors[y]){const R=l.let("_v",(0,e._)`${t.default.dynamicAnchors}${(0,e.getProperty)(y)}`);l.if(R,S(R,w),S(m.validateName,w))}else S(m.validateName,w)()}function S(w,R){return R?()=>l.block(()=>{(0,i.callRef)(c,w),l.let(R,!0)}):()=>(0,i.callRef)(c,w)}}return so.dynamicRef=o,so.default=r,so}var md={},ew;function $M(){if(ew)return md;ew=1,Object.defineProperty(md,"__esModule",{value:!0});const e=h2(),t=yt(),i={keyword:"$recursiveAnchor",schemaType:"boolean",code(r){r.schema?(0,e.dynamicAnchor)(r,""):(0,t.checkStrictMode)(r.it,"$recursiveAnchor: false is ignored")}};return md.default=i,md}var vd={},tw;function LM(){if(tw)return vd;tw=1,Object.defineProperty(vd,"__esModule",{value:!0});const e=f2(),t={keyword:"$recursiveRef",schemaType:"string",code:i=>(0,e.dynamicRef)(i,i.schema)};return vd.default=t,vd}var sw;function IM(){if(sw)return pd;sw=1,Object.defineProperty(pd,"__esModule",{value:!0});const e=h2(),t=f2(),i=$M(),r=LM(),o=[e.default,t.default,i.default,r.default];return pd.default=o,pd}var gd={},_d={},iw;function PM(){if(iw)return _d;iw=1,Object.defineProperty(_d,"__esModule",{value:!0});const e=Sg(),t={keyword:"dependentRequired",type:"object",schemaType:"object",error:e.error,code:i=>(0,e.validatePropertyDeps)(i)};return _d.default=t,_d}var yd={},nw;function BM(){if(nw)return yd;nw=1,Object.defineProperty(yd,"__esModule",{value:!0});const e=Sg(),t={keyword:"dependentSchemas",type:"object",schemaType:"object",code:i=>(0,e.validateSchemaDeps)(i)};return yd.default=t,yd}var bd={},rw;function HM(){if(rw)return bd;rw=1,Object.defineProperty(bd,"__esModule",{value:!0});const e=yt(),t={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:i,parentSchema:r,it:o}){r.contains===void 0&&(0,e.checkStrictMode)(o,`"${i}" without "contains" is ignored`)}};return bd.default=t,bd}var aw;function zM(){if(aw)return gd;aw=1,Object.defineProperty(gd,"__esModule",{value:!0});const e=PM(),t=BM(),i=HM(),r=[e.default,t.default,i.default];return gd.default=r,gd}var Sd={},wd={},ow;function UM(){if(ow)return wd;ow=1,Object.defineProperty(wd,"__esModule",{value:!0});const e=ft(),t=yt(),i=en(),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:f,schema:l,data:d,errsCount:m,it:y}=c;if(!m)throw new Error("ajv implementation error");const{allErrors:v,props:S}=y;S instanceof e.Name?f.if((0,e._)`${S} !== true`,()=>f.forIn("key",d,g=>f.if(R(S,g),()=>w(g)))):S!==!0&&f.forIn("key",d,g=>S===void 0?w(g):f.if(x(S,g),()=>w(g))),y.props=!0,c.ok((0,e._)`${m} === ${i.default.errors}`);function w(g){if(l===!1){c.setParams({unevaluatedProperty:g}),c.error(),v||f.break();return}if(!(0,t.alwaysValidSchema)(y,l)){const b=f.name("valid");c.subschema({keyword:"unevaluatedProperties",dataProp:g,dataPropType:t.Type.Str},b),v||f.if((0,e.not)(b),()=>f.break())}}function R(g,b){return(0,e._)`!${g} || !${g}[${b}]`}function x(g,b){const p=[];for(const _ in g)g[_]===!0&&p.push((0,e._)`${b} !== ${_}`);return(0,e.and)(...p)}}};return wd.default=o,wd}var xd={},lw;function qM(){if(lw)return xd;lw=1,Object.defineProperty(xd,"__esModule",{value:!0});const e=ft(),t=yt(),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:f,data:l,it:d}=o,m=d.items||0;if(m===!0)return;const y=c.const("len",(0,e._)`${l}.length`);if(f===!1)o.setParams({len:m}),o.fail((0,e._)`${y} > ${m}`);else if(typeof f=="object"&&!(0,t.alwaysValidSchema)(d,f)){const S=c.var("valid",(0,e._)`${y} <= ${m}`);c.if((0,e.not)(S),()=>v(S,m)),o.ok(S)}d.items=!0;function v(S,w){c.forRange("i",w,y,R=>{o.subschema({keyword:"unevaluatedItems",dataProp:R,dataPropType:t.Type.Num},S),d.allErrors||c.if((0,e.not)(S),()=>c.break())})}}};return xd.default=r,xd}var cw;function FM(){if(cw)return Sd;cw=1,Object.defineProperty(Sd,"__esModule",{value:!0});const e=UM(),t=qM(),i=[e.default,t.default];return Sd.default=i,Sd}var Cd={},Ed={},uw;function VM(){if(uw)return Ed;uw=1,Object.defineProperty(Ed,"__esModule",{value:!0});const e=ft(),i={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:f,$data:l,schema:d,schemaCode:m,it:y}=r,{opts:v,errSchemaPath:S,schemaEnv:w,self:R}=y;if(!v.validateFormats)return;l?x():g();function x(){const b=c.scopeValue("formats",{ref:R.formats,code:v.code.formats}),p=c.const("fDef",(0,e._)`${b}[${m}]`),_=c.let("fType"),k=c.let("format");c.if((0,e._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>c.assign(_,(0,e._)`${p}.type || "string"`).assign(k,(0,e._)`${p}.validate`),()=>c.assign(_,(0,e._)`"string"`).assign(k,p)),r.fail$data((0,e.or)(A(),C()));function A(){return v.strictSchema===!1?e.nil:(0,e._)`${m} && !${k}`}function C(){const N=w.$async?(0,e._)`(${p}.async ? await ${k}(${f}) : ${k}(${f}))`:(0,e._)`${k}(${f})`,j=(0,e._)`(typeof ${k} == "function" ? ${N} : ${k}.test(${f}))`;return(0,e._)`${k} && ${k} !== true && ${_} === ${o} && !${j}`}}function g(){const b=R.formats[d];if(!b){A();return}if(b===!0)return;const[p,_,k]=C(b);p===o&&r.pass(N());function A(){if(v.strictSchema===!1){R.logger.warn(j());return}throw new Error(j());function j(){return`unknown format "${d}" ignored in schema at path "${S}"`}}function C(j){const M=j instanceof RegExp?(0,e.regexpCode)(j):v.code.formats?(0,e._)`${v.code.formats}${(0,e.getProperty)(d)}`:void 0,O=c.scopeValue("formats",{key:d,ref:j,code:M});return typeof j=="object"&&!(j instanceof RegExp)?[j.type||"string",j.validate,(0,e._)`${O}.validate`]:["string",j,O]}function N(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!w.$async)throw new Error("async format in sync schema");return(0,e._)`await ${k}(${f})`}return typeof _=="function"?(0,e._)`${k}(${f})`:(0,e._)`${k}.test(${f})`}}}};return Ed.default=i,Ed}var dw;function WM(){if(dw)return Cd;dw=1,Object.defineProperty(Cd,"__esModule",{value:!0});const t=[VM().default];return Cd.default=t,Cd}var Qr={},hw;function GM(){return hw||(hw=1,Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.contentVocabulary=Qr.metadataVocabulary=void 0,Qr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Qr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),Qr}var fw;function KM(){if(fw)return Pu;fw=1,Object.defineProperty(Pu,"__esModule",{value:!0});const e=cM(),t=SM(),i=OM(),r=IM(),o=zM(),c=FM(),f=WM(),l=GM(),d=[r.default,e.default,t.default,(0,i.default)(!0),f.default,l.metadataVocabulary,l.contentVocabulary,o.default,c.default];return Pu.default=d,Pu}var kd={},$l={},pw;function YM(){if(pw)return $l;pw=1,Object.defineProperty($l,"__esModule",{value:!0}),$l.DiscrError=void 0;var e;return(function(t){t.Tag="tag",t.Mapping="mapping"})(e||($l.DiscrError=e={})),$l}var mw;function XM(){if(mw)return kd;mw=1,Object.defineProperty(kd,"__esModule",{value:!0});const e=ft(),t=YM(),i=Mh(),r=Nh(),o=yt(),f={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:l,tagName:d}})=>l===t.DiscrError.Tag?`tag "${d}" must be string`:`value of tag "${d}" must be in oneOf`,params:({params:{discrError:l,tag:d,tagName:m}})=>(0,e._)`{error: ${l}, tag: ${m}, tagValue: ${d}}`},code(l){const{gen:d,data:m,schema:y,parentSchema:v,it:S}=l,{oneOf:w}=v;if(!S.opts.discriminator)throw new Error("discriminator: requires discriminator option");const R=y.propertyName;if(typeof R!="string")throw new Error("discriminator: requires propertyName");if(y.mapping)throw new Error("discriminator: mapping is not supported");if(!w)throw new Error("discriminator: requires oneOf keyword");const x=d.let("valid",!1),g=d.const("tag",(0,e._)`${m}${(0,e.getProperty)(R)}`);d.if((0,e._)`typeof ${g} == "string"`,()=>b(),()=>l.error(!1,{discrError:t.DiscrError.Tag,tag:g,tagName:R})),l.ok(x);function b(){const k=_();d.if(!1);for(const A in k)d.elseIf((0,e._)`${g} === ${A}`),d.assign(x,p(k[A]));d.else(),l.error(!1,{discrError:t.DiscrError.Mapping,tag:g,tagName:R}),d.endIf()}function p(k){const A=d.name("valid"),C=l.subschema({keyword:"oneOf",schemaProp:k},A);return l.mergeEvaluated(C,e.Name),A}function _(){var k;const A={},C=j(v);let N=!0;for(let B=0;B<w.length;B++){let q=w[B];if(q!=null&&q.$ref&&!(0,o.schemaHasRulesButRef)(q,S.self.RULES)){const J=q.$ref;if(q=i.resolveRef.call(S.self,S.schemaEnv.root,S.baseId,J),q instanceof i.SchemaEnv&&(q=q.schema),q===void 0)throw new r.default(S.opts.uriResolver,S.baseId,J)}const V=(k=q==null?void 0:q.properties)===null||k===void 0?void 0:k[R];if(typeof V!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${R}"`);N=N&&(C||j(q)),M(V,B)}if(!N)throw new Error(`discriminator: "${R}" must be required`);return A;function j({required:B}){return Array.isArray(B)&&B.includes(R)}function M(B,q){if(B.const)O(B.const,q);else if(B.enum)for(const V of B.enum)O(V,q);else throw new Error(`discriminator: "properties/${R}" must have "const" or "enum"`)}function O(B,q){if(typeof B!="string"||B in A)throw new Error(`discriminator: "${R}" values must be unique strings`);A[B]=q}}}};return kd.default=f,kd}var Ad={};const JM="https://json-schema.org/draft/2020-12/schema",ZM="https://json-schema.org/draft/2020-12/schema",QM={"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},eD="meta",tD="Core and Validation specifications meta-schema",sD=[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],iD=["object","boolean"],nD="This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",rD={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}},aD={$schema:JM,$id:ZM,$vocabulary:QM,$dynamicAnchor:eD,title:tD,allOf:sD,type:iD,$comment:nD,properties:rD},oD="https://json-schema.org/draft/2020-12/schema",lD="https://json-schema.org/draft/2020-12/meta/applicator",cD={"https://json-schema.org/draft/2020-12/vocab/applicator":!0},uD="meta",dD="Applicator vocabulary meta-schema",hD=["object","boolean"],fD={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"}},pD={schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}},mD={$schema:oD,$id:lD,$vocabulary:cD,$dynamicAnchor:uD,title:dD,type:hD,properties:fD,$defs:pD},vD="https://json-schema.org/draft/2020-12/schema",gD="https://json-schema.org/draft/2020-12/meta/unevaluated",_D={"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},yD="meta",bD="Unevaluated applicator vocabulary meta-schema",SD=["object","boolean"],wD={unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}},xD={$schema:vD,$id:gD,$vocabulary:_D,$dynamicAnchor:yD,title:bD,type:SD,properties:wD},CD="https://json-schema.org/draft/2020-12/schema",ED="https://json-schema.org/draft/2020-12/meta/content",kD={"https://json-schema.org/draft/2020-12/vocab/content":!0},AD="meta",jD="Content vocabulary meta-schema",RD=["object","boolean"],TD={contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}},ND={$schema:CD,$id:ED,$vocabulary:kD,$dynamicAnchor:AD,title:jD,type:RD,properties:TD},MD="https://json-schema.org/draft/2020-12/schema",DD="https://json-schema.org/draft/2020-12/meta/core",OD={"https://json-schema.org/draft/2020-12/vocab/core":!0},$D="meta",LD="Core vocabulary meta-schema",ID=["object","boolean"],PD={$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"}}},BD={anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}},HD={$schema:MD,$id:DD,$vocabulary:OD,$dynamicAnchor:$D,title:LD,type:ID,properties:PD,$defs:BD},zD="https://json-schema.org/draft/2020-12/schema",UD="https://json-schema.org/draft/2020-12/meta/format-annotation",qD={"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},FD="meta",VD="Format vocabulary meta-schema for annotation results",WD=["object","boolean"],GD={format:{type:"string"}},KD={$schema:zD,$id:UD,$vocabulary:qD,$dynamicAnchor:FD,title:VD,type:WD,properties:GD},YD="https://json-schema.org/draft/2020-12/schema",XD="https://json-schema.org/draft/2020-12/meta/meta-data",JD={"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},ZD="meta",QD="Meta-data vocabulary meta-schema",eO=["object","boolean"],tO={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}},sO={$schema:YD,$id:XD,$vocabulary:JD,$dynamicAnchor:ZD,title:QD,type:eO,properties:tO},iO="https://json-schema.org/draft/2020-12/schema",nO="https://json-schema.org/draft/2020-12/meta/validation",rO={"https://json-schema.org/draft/2020-12/vocab/validation":!0},aO="meta",oO="Validation vocabulary meta-schema",lO=["object","boolean"],cO={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"}}},uO={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:[]}},dO={$schema:iO,$id:nO,$vocabulary:rO,$dynamicAnchor:aO,title:oO,type:lO,properties:cO,$defs:uO};var vw;function hO(){if(vw)return Ad;vw=1,Object.defineProperty(Ad,"__esModule",{value:!0});const e=aD,t=mD,i=xD,r=ND,o=HD,c=KD,f=sO,l=dO,d=["/properties"];function m(y){return[e,t,i,r,o,v(this,c),f,v(this,l)].forEach(S=>this.addMetaSchema(S,void 0,!1)),this;function v(S,w){return y?S.$dataMetaSchema(w,d):w}}return Ad.default=m,Ad}var gw;function fO(){return gw||(gw=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 i=oM(),r=KM(),o=XM(),c=hO(),f="https://json-schema.org/draft/2020-12/schema";class l extends i.default{constructor(w={}){super({...w,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),r.default.forEach(w=>this.addVocabulary(w)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:w,meta:R}=this.opts;R&&(c.default.call(this,w),this.refs["http://json-schema.org/schema"]=f)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(f)?f:void 0)}}t.Ajv2020=l,e.exports=t=l,e.exports.Ajv2020=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var d=Th();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var m=ft();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 y=_g();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return y.default}});var v=Nh();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return v.default}})})(Du,Du.exports)),Du.exports}var pO=fO();const mO=Vk(pO),p2="sapiom.studio.run-input.v1:",m2="sapiom.studio.run-target.v1:";function Dh(e,t){return`${e}${encodeURIComponent(t)}`}function Oh(){try{return typeof window>"u"?null:window.localStorage}catch{return null}}function _w(e){var t;try{const i=(t=Oh())==null?void 0:t.getItem(Dh(p2,e));if(!i)return null;const r=JSON.parse(i);return"value"in r?{value:r.value,schemaSignature:typeof r.schemaSignature=="string"?r.schemaSignature:null}:null}catch{return null}}function vO(e,t,i){var r;try{(r=Oh())==null||r.setItem(Dh(p2,e),JSON.stringify({value:t,schemaSignature:i}))}catch{}}function yw(e){var t;try{return((t=Oh())==null?void 0:t.getItem(Dh(m2,e)))==="prod"?"prod":"local"}catch{return"local"}}function gO(e,t){var i;try{(i=Oh())==null||i.setItem(Dh(m2,e),t)}catch{}}function _O(e){const t=i=>Array.isArray(i)?i.map(t):i&&typeof i=="object"?Object.fromEntries(Object.entries(i).sort(([r],[o])=>r.localeCompare(o)).map(([r,o])=>[r,t(o)])):i;return JSON.stringify(t(e))}function yO(e){return Array.isArray(e.examples)&&e.examples.length>0?e.examples[0]:Object.prototype.hasOwnProperty.call(e,"example")?e.example:void 0}function v2(e){if(Object.prototype.hasOwnProperty.call(e,"default"))return e.default;if(e.type==="object"){const t=e.properties??{},i={};for(const[r,o]of Object.entries(t)){const c=v2(o);c!==void 0&&(i[r]=c)}return Object.keys(i).length>0?i:void 0}}function Lv(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 g2(e);default:return null}}function g2(e){if(e.type!=="object")return Lv(e);const t=Array.isArray(e.required)?e.required.filter(r=>typeof r=="string"):[],i=e.properties??{};return Object.fromEntries(t.map(r=>[r,Lv(i[r]??{})]))}function qd(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 i=e.properties??{},r=new Set(Array.isArray(e.required)?e.required.filter(c=>typeof c=="string"):[]),o=t?{...e.default}:{};for(const[c,f]of Object.entries(i)){if(Object.prototype.hasOwnProperty.call(o,c)){const d=o[c];f.type==="object"&&d!==null&&typeof d=="object"&&!Array.isArray(d)&&(o[c]=qd({...f,default:d}));continue}v2(f)!==void 0?o[c]=qd(f):r.has(c)&&(o[c]=qd(f)??Lv(f))}return Object.keys(o).length>0?o:void 0}function fo(e){const t=yO(e);if(t!==void 0)return t;const i=qd(e);return i!==void 0?i:g2(e)}function bO(e){const t=e.nodes.find(i=>i.id===e.entry);return t?t.inputSchema?{status:"available",jsonSchema:t.inputSchema,example:fo(t.inputSchema)}:{status:"none",jsonSchema:null,example:{}}:null}function SO(e){const i=new mO({allErrors:!0,strict:!1}).compile(e);return{validate:i,validateValue(r){return i(r)?[]:[...i.errors??[]]}}}function _2(e){if(e.keyword==="required"){const t=e.params.missingProperty;if(typeof t=="string")return`${e.instancePath}/${t}`}return e.instancePath||"/"}function lo(e){return`${_2(e).split("/").filter(Boolean).map(i=>i.replaceAll("~1","/").replaceAll("~0","~")).join(" → ")||"Input"} ${e.message??"is invalid"}`}function rc(e,t,i){const r={event:e,...t?{data:t}:{}};fetch("/api/track",{method:"POST",headers:{"Content-Type":"application/json","X-Harness-Token":co()},body:JSON.stringify(r),keepalive:!0}).catch(()=>{})}const wO=[{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 xO({open:e,anchorRef:t,selected:i,cloudDisabledReason:r,onDismiss:o,onSelect:c}){return h.jsx(fn,{open:e,anchorRef:t,onDismiss:o,placement:"down-end",className:"canvas-run-menu session-run-menu",role:"menu",testid:"session-run-target-menu",children:wO.map(f=>{const l=f.id==="prod"?r:null,d=i===f.id;return h.jsxs("button",{className:"run-target-option","data-selected":d||void 0,"data-testid":f.id==="prod"?"session-step-run":"run-target-local",type:"button",role:"menuitemradio","aria-checked":d,disabled:!!l,title:l??void 0,onClick:()=>c(f.id),children:[h.jsx(de,{name:f.icon,size:15}),h.jsxs("span",{className:"run-target-copy",children:[h.jsx("strong",{children:f.label}),h.jsx("small",{children:l??f.description})]}),h.jsx("span",{className:"run-target-check","aria-hidden":"true",children:d&&h.jsx(de,{name:"Check",size:13})})]},f.id)})})}function CO({workflow:e,activeSessionId:t,sessionReady:i,macros:r,onRunMacro:o,onRequestRun:c,preview:f,lastDeployError:l,authenticated:d,directActionSettleSeq:m,runningTarget:y}){const v=q=>r.find(V=>V.id===q),S=wo(e,l),w=S==="ready",R=e.definitionId!=null?xh(e.definitionId):wh,[x,g]=z.useState(null),[b,p]=z.useState(!1),[_,k]=z.useState(()=>yw(e.path)),A=z.useRef(null),C=z.useRef(null);z.useEffect(()=>{g(null)},[e.path,S,l,m]),z.useEffect(()=>{k(yw(e.path))},[e.path]);const N=[{id:"deploy",label:"Deploy",icon:"CloudUpload",macro:v("deploy"),testId:"session-step-deploy",hint:"Deploy: push and build on Sapiom.",needsAuth:!0,primary:!w}].filter(q=>q.macro),j=(d?null:"Connect your account first")??M1(e,l),M=_==="prod"&&j?"local":_,O=M==="local"?"Local":"Cloud",B=q=>{q==="prod"&&j||(k(q),gO(e.path,q),p(!1),c(q,C.current))};return h.jsxs("div",{className:"session-actions","data-testid":"session-steps","aria-label":"Agent actions",...$t({surface:"agent_actions"}),children:[f&&h.jsxs("a",{className:"status-tag status-tag-action session-preview-chip","data-testid":"session-preview-chip",href:f.url,target:"_blank",rel:"noreferrer","aria-label":`Preview :${f.port}`,"data-tooltip":`The coding agent is serving an app on port ${f.port}. Opens ${f.url}`,children:[h.jsx(de,{name:"ExternalLink",size:12}),h.jsx("span",{className:"session-preview-label",children:"Preview "}),":",f.port]}),h.jsx("a",{className:"session-step session-action-prod","data-testid":"session-step-prod",href:R,target:"_blank",rel:"noreferrer","aria-label":"Open this agent in the Sapiom dashboard","data-tooltip":e.definitionId!=null?"Open this linked agent in the Sapiom dashboard":"Open the Sapiom dashboard",children:h.jsx(de,{name:"Globe",size:14})}),h.jsxs("div",{className:"session-run-split","data-running":y===M||void 0,children:[h.jsxs("button",{ref:C,className:"session-step session-run-main"+(w?" session-action-primary":""),"data-testid":"session-step-local",type:"button",onClick:()=>c(M,C.current),"aria-label":`Run using ${O}`,"data-tooltip":`Review input and run using ${O}`,children:[h.jsx(de,{name:"Play",size:14}),h.jsxs("span",{className:"session-step-label",children:["Run · ",O]})]}),h.jsx("button",{ref:A,className:"session-step session-run-menu-trigger"+(w?" session-action-primary":""),type:"button","aria-label":"Choose run target","aria-haspopup":"menu","aria-expanded":b,onClick:()=>p(q=>!q),children:h.jsx(de,{name:"ChevronDown",size:13})}),h.jsx(xO,{open:b,anchorRef:A,onDismiss:()=>p(!1),selected:_,cloudDisabledReason:j,onSelect:B})]}),N.map(q=>{const V=q.needsAuth&&!d?"Connect your account first":null,J=q.needsDeploy?M1(e,l):null,ee=!i&&q.macro&&q5(q.macro)?"Session is starting":null,W=V??J??ee??(q.macro?F5(q.macro,e,t):null);return h.jsxs("button",{className:"session-step"+(q.primary?" session-action-primary":""),"data-testid":q.testId,"data-pending":x===q.id||void 0,"data-running":void 0,disabled:!!W,"data-tooltip":W?`${q.label}: ${W}`:q.hint,"aria-label":W?`${q.label}: ${W}`:q.label,onClick:()=>{q.macro&&(o(q.macro),g(q.id),rc("macro.invoked",{macroId:q.macro.id}))},children:[h.jsx(de,{name:q.icon,size:14}),h.jsx("span",{className:"session-step-label",children:q.label})]},q.id)})]})}function y2(e,t){const i=String(t).replaceAll("~","~0").replaceAll("/","~1");return`${e}/${i}`}function b2(e,t){return e.filter(i=>_2(i)===(t||"/"))}function Iv(e,t){return typeof e.title=="string"&&e.title.trim()?e.title:t??"Value"}function EO(e){return typeof e.description=="string"&&e.description.trim()?e.description:null}function kO(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"&&AO(t))}return["object","string","number","integer","boolean"].includes(String(e.type))}function AO(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 bw(e){return JSON.stringify(e??null,null,2)}function Sw({value:e,onChange:t,label:i,description:r}){const o=z.useId(),c=r?`${o}-description`:void 0,f=bw(e),l=z.useRef(f),[d,m]=z.useState(f),[y,v]=z.useState(null),S=y?`${o}-error`:void 0;return z.useEffect(()=>{f!==l.current&&(l.current=f,m(f),v(null))},[f]),h.jsxs("div",{className:"schema-field schema-json-field",children:[h.jsx("label",{htmlFor:o,children:i}),r&&h.jsx("p",{id:c,children:r}),h.jsx("textarea",{id:o,value:d,rows:5,spellCheck:!1,"aria-invalid":!!y,"aria-describedby":[c,S].filter(Boolean).join(" ")||void 0,onChange:w=>{const R=w.target.value;m(R);try{const x=JSON.parse(R);v(null),l.current=bw(x),t(x)}catch(x){v(x instanceof Error?x.message:"Enter valid JSON.")}}}),y&&h.jsx("span",{id:S,className:"schema-field-error",children:y})]})}function S2({schema:e,value:t,onChange:i,id:r,ariaLabel:o,describedBy:c,invalid:f=!1,required:l=!1}){if(Array.isArray(e.enum))return h.jsxs("select",{id:r,"aria-label":o,"aria-describedby":c,"aria-invalid":f,required:l,value:t===void 0?"":JSON.stringify(t),onChange:m=>i(m.target.value===""?void 0:JSON.parse(m.target.value)),children:[h.jsx("option",{value:"",children:"Select…"}),e.enum.map((m,y)=>h.jsx("option",{value:JSON.stringify(m),children:String(m)},y))]});if(e.type==="boolean")return h.jsxs("select",{id:r,"aria-label":o,"aria-describedby":c,"aria-invalid":f,required:l,value:t===!0?"true":t===!1?"false":"",onChange:m=>i(m.target.value===""?void 0:m.target.value==="true"),children:[h.jsx("option",{value:"",children:"Not set"}),h.jsx("option",{value:"true",children:"True"}),h.jsx("option",{value:"false",children:"False"})]});const d=e.type==="number"||e.type==="integer";return h.jsx("input",{id:r,type:d?"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:!d&&typeof e.minLength=="number"?e.minLength:void 0,maxLength:!d&&typeof e.maxLength=="number"?e.maxLength:void 0,pattern:!d&&typeof e.pattern=="string"?e.pattern:void 0,"aria-label":o,"aria-describedby":c,"aria-invalid":f,required:l,value:typeof t=="string"||typeof t=="number"?t:"",placeholder:typeof e.placeholder=="string"?e.placeholder:void 0,onChange:m=>{const y=m.target.value;i(d?y===""?void 0:Number(y):y)}})}function jO({schema:e,value:t,onChange:i,errors:r,path:o,label:c}){const f=z.useId(),l=e.items,d=Array.isArray(t)?t:[],m=typeof e.minItems=="number"?e.minItems:0,y=typeof e.maxItems=="number"?e.maxItems:Number.POSITIVE_INFINITY,v=c??Iv(e);return h.jsxs("div",{className:"schema-array",children:[d.map((S,w)=>{const R=y2(o??"",w),x=`${f}-${w}`,g=b2(r,R),b=g.length>0?`${x}-errors`:void 0;return h.jsxs("div",{className:"schema-array-row",children:[h.jsx(S2,{schema:l,value:S,onChange:p=>{const _=[...d];_[w]=p,i(_)},id:x,ariaLabel:`${v} item ${w+1}`,describedBy:b,invalid:g.length>0}),h.jsx("button",{type:"button",className:"theme-toggle","aria-label":`Remove item ${w+1}`,disabled:d.length<=m,onClick:()=>i(d.filter((p,_)=>_!==w)),children:h.jsx(de,{name:"X",size:13})}),g.length>0&&h.jsx("div",{id:b,className:"schema-field-errors",children:g.map((p,_)=>h.jsx("span",{className:"schema-field-error",children:lo(p)},_))})]},w)}),h.jsxs("button",{type:"button",className:"btn-ghost schema-array-add",disabled:d.length>=y,onClick:()=>i([...d,fo(l)]),children:[h.jsx(de,{name:"Plus",size:13})," Add item"]})]})}function w2({schema:e,value:t,onChange:i,errors:r,path:o="",label:c,required:f=!0}){const l=z.useId(),d=Iv(e,c),m=EO(e),y=b2(r,o);if(!kO(e))return h.jsx(Sw,{value:t,onChange:i,label:d,description:m});if(e.type==="object"){const w=t&&typeof t=="object"&&!Array.isArray(t)?t:{},R=e.properties??{},x=new Set(Array.isArray(e.required)?e.required.filter(k=>typeof k=="string"):[]),g=Object.fromEntries(Object.entries(w).filter(([k])=>!(k in R))),b=h.jsxs("div",{className:"schema-object-fields",children:[Object.entries(R).map(([k,A])=>{const C=y2(o,k),N=x.has(k),j=Object.prototype.hasOwnProperty.call(w,k);return h.jsxs("div",{className:"schema-property",children:[!N&&h.jsxs("label",{className:"schema-optional-toggle",children:[h.jsx("input",{type:"checkbox",checked:j,onChange:M=>{const O={...w};M.target.checked?O[k]=fo(A):delete O[k],i(O)}}),"Include ",Iv(A,k)]}),(N||j)&&h.jsx(w2,{schema:A,value:w[k],onChange:M=>i({...w,[k]:M}),errors:r,path:C,label:k,required:N})]},k)}),Object.keys(g).length>0&&h.jsx(Sw,{value:g,label:"Additional fields",description:"These values are not present in the current contract.",onChange:k=>{const A=k&&typeof k=="object"&&!Array.isArray(k)?k:{};i({...Object.fromEntries(Object.entries(w).filter(([C])=>C in R)),...A})}})]});if(o===""){const k=y.length>0?`${l}-errors`:void 0;return h.jsxs("div",{"aria-describedby":k,children:[m&&h.jsx("p",{children:m}),b,y.length>0&&h.jsx("div",{id:k,className:"schema-field-errors",children:y.map((A,C)=>h.jsx("span",{className:"schema-field-error",children:lo(A)},C))})]})}const p=m?`${l}-description`:void 0,_=y.length>0?`${l}-errors`:void 0;return h.jsxs("fieldset",{className:"schema-object","aria-describedby":[p,_].filter(Boolean).join(" ")||void 0,children:[h.jsxs("legend",{children:[d,f&&h.jsx("span",{"aria-label":"required",children:" *"})]}),m&&h.jsx("p",{id:p,children:m}),b,y.length>0&&h.jsx("div",{id:_,className:"schema-field-errors",children:y.map((k,A)=>h.jsx("span",{className:"schema-field-error",children:lo(k)},A))})]})}const v=m?`${l}-description`:void 0,S=y.length>0?`${l}-errors`:void 0;return e.type==="array"?h.jsxs("fieldset",{className:"schema-field schema-array-field","aria-describedby":[v,S].filter(Boolean).join(" ")||void 0,children:[h.jsxs("legend",{children:[d,f&&h.jsx("span",{"aria-label":"required",children:" *"})]}),m&&h.jsx("p",{id:v,children:m}),h.jsx(jO,{schema:e,value:t,onChange:i,errors:r,path:o,label:d}),y.length>0&&h.jsx("div",{id:S,className:"schema-field-errors",children:y.map((w,R)=>h.jsx("span",{className:"schema-field-error",children:lo(w)},R))})]}):h.jsxs("div",{className:"schema-field",children:[h.jsxs("label",{htmlFor:l,children:[d,f&&h.jsx("span",{"aria-label":"required",children:" *"})]}),m&&h.jsx("p",{id:v,children:m}),h.jsx(S2,{schema:e,value:t,onChange:i,id:l,describedBy:[v,S].filter(Boolean).join(" ")||void 0,invalid:y.length>0,required:f}),y.length>0&&h.jsx("div",{id:S,className:"schema-field-errors",children:y.map((w,R)=>h.jsx("span",{className:"schema-field-error",children:lo(w)},R))})]})}function jd(e){return JSON.stringify(e??{},null,2)}function RO({workflow:e,target:t,loadContract:i,onClose:r,returnFocus:o,onRun:c}){const f=z.useRef(null),l=z.useRef(null),d=z.useRef(null),m=z.useRef(null),[y,v]=z.useState(null),[S,w]=z.useState({}),[R,x]=z.useState("{}"),[g,b]=z.useState(null),[p,_]=z.useState([]),[k,A]=z.useState(null),[C,N]=z.useState("form"),[j,M]=z.useState(!1);xo(!0,{onDismiss:r,containerRef:f}),z.useEffect(()=>()=>{o==null||o.focus()},[o]),z.useEffect(()=>{let ee=!0;return v(null),b(null),i(e.path).then(W=>{if(!ee)return;v(W);const Q=_w(e.path);let ie=(Q==null?void 0:Q.value)??W.example,I=null,P=[];if(W.status==="available"){ie=(Q==null?void 0:Q.value)??fo(W.jsonSchema);try{I=SO(W.jsonSchema),P=I.validateValue(ie)}catch{N("json"),b("This contract uses a schema branch Studio cannot render. Edit the complete JSON input instead.")}}else N("json");A(I),w(ie),_(P),M(!!(Q&&P.length>0)),x(jd(ie)),requestAnimationFrame(()=>{var D,H;return(H=l.current??((D=f.current)==null?void 0:D.querySelector("input, select, textarea")))==null?void 0:H.focus()})}).catch(()=>{if(!ee)return;v({status:"unavailable",jsonSchema:null,example:{},reason:"Studio couldn't load this agent's input contract. You can still run it with raw JSON."});const W=_w(e.path),Q=(W==null?void 0:W.value)??{};w(Q),x(jd(Q)),N("json"),b(null),requestAnimationFrame(()=>{var ie;return(ie=l.current)==null?void 0:ie.focus()})}),()=>{ee=!1}},[i,e.path]);const O=()=>{var ie;if(!y)return;let ee=S;if(C==="json")try{ee=JSON.parse(R)}catch(I){b(I instanceof Error?I.message:"Enter valid JSON."),(ie=l.current)==null||ie.focus();return}const W=(k==null?void 0:k.validateValue(ee))??[];if(_(W),W.length>0){b("Fix the highlighted input before running.");return}const Q=y.status==="available"?_O(y.jsonSchema):null;vO(e.path,ee,Q),b(null),c(ee)},B=ee=>{w(ee),x(jd(ee));const W=(k==null?void 0:k.validateValue(ee))??[];_(W),W.length===0&&(b(null),M(!1))},q=ee=>{if(ee===C)return!0;if(ee==="form")try{const W=JSON.parse(R);w(W),_((k==null?void 0:k.validateValue(W))??[]),b(null)}catch(W){return b(W instanceof Error?W.message:"Enter valid JSON."),!1}else x(jd(S)),b(null);return N(ee),!0},V=(y==null?void 0:y.status)==="available"&&k!==null,J=ee=>{var Q;if(!["ArrowLeft","ArrowRight","Home","End"].includes(ee.key))return;ee.preventDefault();const W=ee.key==="Home"?"form":ee.key==="End"||C==="form"?"json":"form";q(W)&&((Q=(W==="form"?d:m).current)==null||Q.focus())};return h.jsx("div",{className:"modal-backdrop run-sheet-backdrop",children:h.jsxs("div",{className:"modal run-sheet",role:"dialog","aria-modal":"true","aria-labelledby":"run-sheet-title",ref:f,onKeyDown:ee=>{var W;if(ee.key==="Tab"){const Q=Array.from(((W=f.current)==null?void 0:W.querySelectorAll("button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), a[href]"))??[]).filter(P=>P.offsetParent!==null),ie=Q[0],I=Q[Q.length-1];ie&&I&&ee.shiftKey&&document.activeElement===ie?(ee.preventDefault(),I.focus()):ie&&I&&!ee.shiftKey&&document.activeElement===I&&(ee.preventDefault(),ie.focus())}ee.key==="Enter"&&(ee.metaKey||ee.ctrlKey)&&(ee.preventDefault(),O())},children:[h.jsxs("header",{className:"run-sheet-header",children:[h.jsxs("div",{children:[h.jsx("div",{className:"run-sheet-kicker",children:t==="local"?"Local execution":"Cloud execution"}),h.jsxs("h2",{id:"run-sheet-title",children:["Run ",e.name]}),h.jsx("p",{children:"Review the agent input, then follow the execution live in Steps."})]}),h.jsx("button",{className:"theme-toggle modal-close",type:"button","aria-label":"Close run dialog",onClick:r,children:h.jsx(de,{name:"X",size:14})})]}),h.jsxs("div",{className:"run-sheet-body",children:[h.jsxs("div",{className:"run-sheet-field-head",children:[h.jsx("h3",{id:"run-sheet-input-heading",children:"Input"}),V?h.jsxs("div",{className:"run-input-mode",role:"tablist","aria-label":"Input editor mode",children:[h.jsx("button",{ref:d,id:"run-sheet-fields-tab",type:"button",role:"tab","aria-controls":"run-sheet-input-panel","aria-selected":C==="form",tabIndex:C==="form"?0:-1,onClick:()=>q("form"),onKeyDown:J,children:"Fields"}),h.jsx("button",{ref:m,id:"run-sheet-json-tab",type:"button",role:"tab","aria-controls":"run-sheet-input-panel","aria-selected":C==="json",tabIndex:C==="json"?0:-1,onClick:()=>q("json"),onKeyDown:J,children:"JSON"})]}):h.jsx("span",{children:"JSON"})]}),h.jsxs("div",{id:"run-sheet-input-panel",role:V?"tabpanel":void 0,"aria-labelledby":V?C==="form"?"run-sheet-fields-tab":"run-sheet-json-tab":"run-sheet-input-heading",children:[y?h.jsxs(h.Fragment,{children:[y.status==="none"&&h.jsx("p",{className:"run-sheet-notice",children:"This agent declares no input contract. Pass an object or any JSON value it accepts."}),y.status==="unavailable"&&h.jsx("p",{className:"run-sheet-notice","data-tone":"warning",children:y.reason}),j&&h.jsxs("div",{className:"run-sheet-stale",role:"status",children:[h.jsx("span",{children:"The saved input no longer matches this agent's contract. Your values are still here so you can repair them."}),h.jsx("button",{type:"button",className:"btn-ghost",onClick:()=>{y.status==="available"&&B(fo(y.jsonSchema))},children:"Reset to defaults"})]}),C==="form"&&y.status==="available"&&k?h.jsxs("div",{className:"run-schema-form",role:"group","aria-labelledby":"run-sheet-input-heading",children:[h.jsx(w2,{schema:y.jsonSchema,value:S,onChange:B,errors:p}),!j&&h.jsx("button",{type:"button",className:"btn-ghost run-sheet-reset",onClick:()=>B(fo(y.jsonSchema)),children:"Reset to defaults"})]}):h.jsx("textarea",{id:"run-sheet-json",ref:l,className:"run-sheet-editor",value:R,onChange:ee=>{x(ee.target.value),b(null)},rows:12,spellCheck:!1,"aria-labelledby":"run-sheet-input-heading","aria-invalid":!!(g||p.length),"aria-describedby":[g?"run-sheet-error":null,p.length>0?"run-sheet-validation":null].filter(Boolean).join(" ")||void 0})]}):h.jsx("div",{className:"run-sheet-loading",role:"status",children:"Loading input contract…"}),C==="json"&&p.length>0&&h.jsx("ul",{id:"run-sheet-validation",className:"run-sheet-validation-list",children:p.map((ee,W)=>h.jsx("li",{children:lo(ee)},W))}),g&&h.jsx("div",{id:"run-sheet-error",className:"modal-error",role:"alert",children:g})]})]}),h.jsxs("footer",{className:"run-sheet-actions",children:[h.jsx("span",{className:"run-sheet-shortcut",children:"⌘/Ctrl + Enter"}),h.jsx("button",{className:"btn-ghost",type:"button",onClick:r,children:"Cancel"}),h.jsxs("button",{className:"btn-primary",type:"button",disabled:!y,onClick:O,"data-testid":"run-sheet-submit",children:[h.jsx(de,{name:"Play",size:14}),"Run ",t==="local"?"locally":"in cloud"]})]})]})})}function TO({onDismiss:e,onOpenSettings:t}){return h.jsxs("div",{className:"telemetry-notice",role:"status","data-testid":"telemetry-notice",children:[h.jsx("div",{className:"telemetry-notice-body",children:h.jsxs("p",{className:"telemetry-notice-text",children:["Sharing session details with Sapiom is ",h.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"," ",h.jsx("button",{className:"telemetry-notice-settings-link",onClick:()=>{t(),e()},children:"Settings"}),", or use the indicator in the top bar."]})}),h.jsx("button",{className:"telemetry-notice-dismiss","aria-label":"Dismiss analytics notice","data-testid":"telemetry-notice-dismiss",onClick:e,children:"×"})]})}const po="(none)",ww={query:"",category:null,cadence:null};function NO(e){return e.query.trim()!==""||e.category!==null||e.cadence!==null}const MO={"on-demand":"On demand",scheduled:"Scheduled","on-event":"On event","on-webhook":"Webhook"};function x2(e){return e?MO[e]??e.replace(/-/g," ").replace(/^./,t=>t.toUpperCase()):"No trigger declared"}function C2(e,t,i){const r=new Map;for(const o of e){const c=t(o)??po;r.set(c,(r.get(c)??0)+1)}return[...r.entries()].map(([o,c])=>({value:o,label:i(o),count:c})).sort((o,c)=>o.value===po?1:c.value===po?-1:c.count-o.count||o.label.localeCompare(c.label))}function DO(e){return C2(e,t=>t.category,t=>t===po?"Uncategorised":h5(t))}function OO(e){return C2(e,t=>t.cadence,t=>t===po?"No trigger declared":x2(t))}function xw(e,t){return t===null?!0:t===po?e===null:e===t}function $O(e,t,i){return e.filter(r=>i(r,t.query)&&xw(r.category,t.category)&&xw(r.cadence,t.cadence))}function Fd({children:e,variant:t="tag",title:i}){return h.jsx("span",{className:t==="count"?"pill pill--count":"pill",title:i,children:e})}const Cw=3;function LO({template:e,onPreview:t,onUse:i}){const[r,o]=z.useState(!1),c=z.useRef(null),f=[{term:"Steps",value:String(e.stepCount)},{term:"Trigger",value:e.cadence?x2(e.cadence):"Not declared"},{term:"Complexity",value:gg(e.complexity),...e.complexity?{title:f5(e.complexity)}:{title:"This catalog response carried no complexity band."}},{term:"Capabilities",value:e.capabilities.length>0?String(e.capabilities.length):"None"}];return h.jsxs(h.Fragment,{children:[h.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:h.jsx(de,{name:"Info",size:14})}),h.jsxs(fn,{open:r,anchorRef:c,onDismiss:()=>o(!1),placement:"down-end",className:"template-facts",testid:"template-facts",children:[h.jsx("dl",{className:"template-fact-list",children:f.map(l=>h.jsxs("div",{className:"template-fact",children:[h.jsx("dt",{children:l.term}),h.jsx("dd",{title:l.title,children:l.value})]},l.term))}),h.jsxs("div",{className:"template-fact-actions",children:[h.jsx("button",{type:"button",className:"btn-line","data-testid":`template-facts-preview-${e.id}`,onClick:()=>{o(!1),t(e)},children:"Preview"}),h.jsx("button",{type:"button",className:"btn-primary","data-testid":`template-facts-use-${e.id}`,onClick:()=>{o(!1),i(e)},children:"Use"})]})]})]})}function Ew({template:e,onOpen:t,onUse:i}){const r=e.kind==="gallery"?e.tags.slice(0,Cw):[],o=e.kind==="gallery"?e.tags.length-r.length:0;return h.jsxs("article",{className:"template-card","data-testid":`template-card-${e.id}`,children:[h.jsx("button",{type:"button",className:"template-card-hitbox","data-testid":`template-card-open-${e.id}`,onClick:()=>t(e),children:h.jsxs("span",{className:"visually-hidden",children:["Open ",e.name]})}),h.jsxs("div",{className:"template-card-header",children:[h.jsx("h3",{className:"template-card-name",children:e.name}),e.kind==="gallery"&&h.jsx(LO,{template:e,onPreview:t,onUse:i})]}),h.jsx("p",{className:"template-card-desc","data-testid":"template-card-desc",children:e.description}),e.kind==="starter"?h.jsx("div",{className:"template-card-tags",children:h.jsx(Fd,{children:"bundled"})}):r.length>0&&h.jsxs("div",{className:"template-card-tags",children:[r.map(c=>h.jsx(Fd,{children:c},c)),o>0&&h.jsxs(Fd,{variant:"count",title:e.tags.slice(Cw).join(", "),children:["+",o]})]})]})}function IO({detail:e}){const t=v5(e);return h.jsx("div",{className:"template-graph","data-testid":"template-graph",children:t.nodes.map(i=>{const r=t.edges.filter(o=>o.from===i.id);return h.jsxs("div",{className:"template-graph-item","data-testid":`template-graph-node-${i.id}`,children:[h.jsxs("div",{className:"template-graph-node",children:[h.jsx("span",{className:"canvas-step-dot dot--"+i.kind,"aria-hidden":"true"}),h.jsx("span",{className:"template-graph-name",children:i.label}),i.kind==="terminal-success"&&h.jsx("span",{className:"template-step-exit",children:"exit"}),i.kind==="terminal-warn"&&h.jsx("span",{className:"template-step-exit template-step-exit--warn",children:"fails out"}),i.kind==="pause"&&h.jsx("span",{className:"template-step-pause",children:"pause"}),i.capabilities.map(o=>h.jsx("code",{className:"template-cap",children:o},o))]}),r.map(o=>h.jsxs("div",{className:"canvas-step-transition template-graph-edge",children:[h.jsx(de,{name:"CornerDownRight",size:12}),h.jsx("span",{className:"canvas-step-transition-target",children:o.to}),o.label&&h.jsx("span",{className:"canvas-step-transition-label",children:o.label})]},`${o.from}->${o.to}`))]},i.id)})})}function PO({example:e,index:t}){return h.jsxs("details",{className:"template-example",children:[h.jsx("summary",{className:"template-example-summary",children:e.title??`Example ${t+1}`}),h.jsxs("div",{className:"template-example-body",children:[h.jsx("span",{className:"template-example-label",children:"Input"}),h.jsx("pre",{className:"template-example-json",children:JSON.stringify(e.input,null,2)}),e.output!==null&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"template-example-label",children:"Output"}),h.jsx("pre",{className:"template-example-json",children:JSON.stringify(e.output,null,2)})]})]})]})}function BO({detail:e}){return h.jsxs(h.Fragment,{children:[e.whatItDoes&&h.jsx("p",{className:"template-lead",children:e.whatItDoes}),e.steps.length>0&&h.jsxs("section",{className:"template-section",children:[h.jsx("h4",{className:"template-section-title",children:"Steps"}),h.jsx(IO,{detail:e}),h.jsx("ol",{className:"template-steps",children:e.steps.map((t,i)=>h.jsxs("li",{className:"template-step",children:[h.jsx("span",{className:"template-step-index","aria-hidden":"true",children:i+1}),h.jsxs("span",{className:"template-step-copy",children:[h.jsxs("span",{className:"template-step-name",children:[t.name,h.jsx("span",{className:"template-step-role",children:t.sublabel})]}),t.description&&h.jsx("span",{className:"template-step-desc",children:t.description})]}),t.capabilities.map(r=>h.jsx("code",{className:"template-cap",children:r},r))]},t.name))})]}),h.jsxs("section",{className:"template-section",children:[h.jsx("h4",{className:"template-section-title",children:"Capabilities and complexity"}),e.capabilities.length>0?h.jsx("div",{className:"template-caps",children:e.capabilities.map(t=>h.jsx("code",{className:"template-cap",children:t},t))}):h.jsx("p",{className:"template-note","data-testid":"template-caps-none",children:"Declares no metered capabilities."}),h.jsx("p",{className:"template-note","data-testid":"template-complexity-note",children:e.complexity?h.jsxs(h.Fragment,{children:[h.jsx("strong",{children:gg(e.complexity)})," —"," ",JC(e.complexity),". A rough estimate of how involved this template is, not a price. Local test runs stub every capability and are free."]}):h.jsx(h.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&&h.jsxs("section",{className:"template-section",children:[h.jsx("h4",{className:"template-section-title",children:"Credentials you supply"}),h.jsx("ul",{className:"template-usecases",children:e.requiredSecrets.map(t=>h.jsxs("li",{children:[h.jsx("code",{className:"template-cap",children:t.key})," ",t.label,t.description&&h.jsxs(h.Fragment,{children:[" — ",t.description]})]},t.key))})]}),e.useCases.length>0&&h.jsxs("section",{className:"template-section",children:[h.jsx("h4",{className:"template-section-title",children:"Use cases"}),h.jsx("ul",{className:"template-usecases",children:e.useCases.map(t=>h.jsx("li",{children:t},t))})]}),e.examples.length>0&&h.jsxs("section",{className:"template-section",children:[h.jsx("h4",{className:"template-section-title",children:"Examples"}),e.examples.map((t,i)=>h.jsx(PO,{example:t,index:i},t.title??i))]}),e.notes&&h.jsxs("section",{className:"template-section",children:[h.jsx("h4",{className:"template-section-title",children:"Notes"}),h.jsx("div",{className:"template-notes",children:h.jsx(t2,{text:e.notes})})]})]})}function HO({template:e,getTemplate:t}){const[i,r]=z.useState(null),[o,c]=z.useState(null);return z.useEffect(()=>{if(e.kind!=="gallery"){r(null),c(null);return}let f=!1;return r(null),c(null),t(e.id).then(l=>{f||r(l)}).catch(l=>{f||c(l instanceof Error?l.message:String(l))}),()=>{f=!0}},[e.kind,e.id,t]),h.jsxs("div",{className:"template-detail","data-testid":"template-detail",...$t({surface:"template_detail",object:"template"}),children:[h.jsxs("div",{className:"template-detail-head",children:[h.jsx("h3",{className:"template-detail-name",children:e.name}),h.jsx("div",{className:"template-tags",children:(e.kind==="gallery"?e.tags:["bundled"]).map(f=>h.jsx("span",{className:"template-tag",children:f},f))})]}),e.kind==="gallery"?h.jsxs(h.Fragment,{children:[(i==null?void 0:i.author)&&h.jsxs("span",{className:"template-byline",children:["By"," ",i.author.url?h.jsx("a",{href:i.author.url,target:"_blank",rel:"noopener noreferrer",children:i.author.name}):i.author.name]}),!i&&!o&&h.jsx("p",{className:"template-lead",children:e.description}),o&&h.jsxs("p",{className:"template-note","data-testid":"template-detail-error",children:["Could not load this template’s details: ",o]}),i&&h.jsx(BO,{detail:i})]}):h.jsxs(h.Fragment,{children:[h.jsx("p",{className:"template-lead",children:e.description}),h.jsx("p",{className:"template-note",children:"Scaffolds an npm-install-ready TypeScript project with a starter agent in index.ts."})]}),h.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 kw({title:e,allLabel:t,allCount:i,options:r,value:o,onSelect:c,testIdPrefix:f}){if(r.length<2)return null;const l=[{value:"",label:t,count:i,testId:`${f}-all`,selects:null},...r.map(d=>({...d,testId:`${f}-${d.value}`,selects:d.value}))];return h.jsxs("div",{className:"facet",children:[h.jsx("span",{className:"facet-title",children:e}),h.jsx("div",{className:"facet-rows",role:"radiogroup","aria-label":e,children:l.map(d=>{const m=o===d.selects;return h.jsxs("button",{type:"button",role:"radio","aria-checked":m,className:m?"facet-row is-active":"facet-row","data-testid":d.testId,onClick:()=>c(d.selects),children:[h.jsx("span",{className:"facet-row-label",children:d.label}),h.jsx(Fd,{variant:"count",children:d.count})]},d.testId)})})]})}function zO({catalog:e,filter:t,onChange:i}){return h.jsxs("div",{className:"template-filters","data-testid":"template-filters",children:[h.jsxs("div",{className:"template-search",children:[h.jsx(de,{name:"Search",size:14}),h.jsx("input",{className:"template-search-input",type:"search",value:t.query,placeholder:"Search templates","aria-label":"Search templates","data-testid":"template-search",onChange:r=>i({...t,query:r.target.value})})]}),h.jsx(kw,{title:"Category",allLabel:"All templates",allCount:e.length,options:DO(e),value:t.category,onSelect:r=>i({...t,category:r}),testIdPrefix:"templates-category"}),h.jsx(kw,{title:"Trigger",allLabel:"Any trigger",allCount:e.length,options:OO(e),value:t.cadence,onSelect:r=>i({...t,cadence:r}),testIdPrefix:"templates-cadence"})]})}function UO(){return typeof window>"u"?void 0:window}function Xn(e=UO()){const t=e==null?void 0:e.sapiomDesktop;if(!t||typeof t!="object")return null;const i=t;return typeof i.checkForUpdates!="function"?null:{appVersion:typeof i.appVersion=="string"?i.appVersion:"",checkForUpdates:i.checkForUpdates,chooseDirectory:typeof i.chooseDirectory=="function"?i.chooseDirectory:void 0,onDeepLink:typeof i.onDeepLink=="function"?i.onDeepLink:void 0,onUpdateState:typeof i.onUpdateState=="function"?i.onUpdateState:void 0,pathForFile:typeof i.pathForFile=="function"?i.pathForFile:void 0}}function E2(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 k2({value:e,onChange:t,onSubmit:i,recentDirs:r,listDir:o,onNewDirChange:c,onResolve:f}){var H;const[l,d]=z.useState(e),[m,y]=z.useState([]),[v,S]=z.useState(e),[w,R]=z.useState(!1),[x,g]=z.useState(null),[b,p]=z.useState(0),[_,k]=z.useState(!0),[A,C]=z.useState(!1),[N,j]=z.useState(0),M=z.useRef(null),[O,B]=z.useState("none"),q=()=>{const U=M.current;if(!U)return;const L=U.scrollLeft>2,G=U.scrollLeft+U.clientWidth<U.scrollWidth-2;B(L&&G?"both":L?"left":G?"right":"none")};z.useEffect(()=>{q()},[r]),z.useEffect(()=>{let U=!1;R(!0),g(null),C(!1);const L=setTimeout(()=>{o(e||void 0).then(G=>{U||(d(G.path),y(G.dirs),S(G.parent))}).catch(async()=>{const G=GC(e);if(!G||U){U||g("Couldn't read that directory.");return}try{const se=await o(G);if(U)return;d(se.path),y(se.dirs),S(se.parent),C(!0)}catch{U||g("Couldn't read that directory.")}}).finally(()=>!U&&R(!1))},150);return()=>{U=!0,clearTimeout(L)}},[e,N]);const V=U=>U.replace(/\\/g,"/"),J=V(e).startsWith(V(l))?e.slice(l.length).replace(/^[\\/]+/,""):"",ee=J?m.filter(U=>U.name.toLowerCase().startsWith(J.toLowerCase())):m,W=Math.min(b,Math.max(ee.length-1,0)),Q=!w&&!x&&ee.length===0&&(A||J!=="");z.useEffect(()=>{c==null||c(Q)},[Q]),z.useEffect(()=>{w||x||f==null||f({resolvedPath:l,dirs:m,parent:v,isNew:Q})},[l,m,v,Q,w,x]);const ie=U=>t(U),I=((H=Xn())==null?void 0:H.chooseDirectory)??null,P=()=>{if(I){I(e||l||void 0).then(U=>{U&&t(U)}).catch(()=>{});return}if(!_){k(!0);return}Q&&l&&l!==e?ie(l):k(!1)},D=U=>{var G;const L=_&&ee.length>0;U.key==="ArrowDown"&&L?(U.preventDefault(),p(Math.min(W+1,ee.length-1))):U.key==="ArrowUp"&&L?(U.preventDefault(),p(Math.max(W-1,0))):U.key==="Enter"&&(L?(ie(((G=ee[W])==null?void 0:G.path)??ee[0].path),p(0)):i())};return h.jsxs("div",{className:"dir-picker",children:[h.jsxs("div",{className:"dir-picker-inputrow",children:[h.jsx("button",{type:"button",className:"dir-picker-up","data-testid":"dir-picker-up",disabled:v===l,onClick:()=>ie(v),"aria-label":"Up to parent directory","data-tooltip":"Up to parent directory",children:h.jsx(de,{name:"CornerLeftUp",size:14})}),h.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}),h.jsx("button",{type:"button",className:"dir-picker-up dir-picker-browse"+(!I&&_?" is-active":""),"data-testid":"dir-picker-browse","aria-pressed":I?void 0:_,onClick:P,"aria-label":I?"Choose a folder":"Browse subdirectories","data-tooltip":I?"Choose a folder…":_?Q?"Browse the nearest existing folder":"Hide the directory listing":"Browse subdirectories",children:h.jsx(de,{name:"Folder",size:14})})]}),r.length>0&&h.jsx("div",{className:"recent-dirs",ref:M,"data-fade":O,onScroll:q,children:r.map(U=>h.jsx("button",{type:"button",className:"recent-dir-chip",title:U,onClick:()=>ie(U),children:F4(U)},U))}),_&&h.jsxs("div",{className:"dir-picker-listing","data-testid":"dir-picker-listing",children:[h.jsx("div",{className:"dir-picker-path",children:l}),w&&h.jsx("div",{className:"dir-picker-empty",children:"Loading…"}),!w&&x&&h.jsxs("div",{className:"dir-picker-error","data-testid":"dir-picker-error",role:"alert",children:[h.jsx(de,{name:"TriangleAlert",size:14}),h.jsx("span",{children:x}),h.jsx("button",{type:"button",className:"btn-ghost dir-picker-retry","data-testid":"dir-picker-retry",onClick:()=>j(U=>U+1),children:"Retry"})]}),Q&&h.jsx("div",{className:"dir-picker-newdir","data-testid":"dir-picker-newdir",children:"New folder. It will be created when you start."}),!w&&!x&&!Q&&ee.length===0&&h.jsx("div",{className:"dir-picker-empty",children:"No subdirectories"}),!w&&!x&&ee.map((U,L)=>h.jsxs("button",{type:"button",className:"dir-picker-item"+(L===W?" is-selected":""),"data-testid":`dir-picker-item-${U.name}`,onMouseEnter:()=>p(L),onClick:()=>ie(U.path),...$t({object:"directory"}),children:[h.jsx(de,{name:"Folder",size:13}),h.jsx("span",{className:"dir-picker-item-name",children:U.name}),U.hasAgentProject&&h.jsxs("span",{className:"dir-picker-item-badge","data-testid":`dir-picker-badge-${U.name}`,title:"Contains sapiom.json",children:[h.jsx(de,{name:"Check",size:11}),"Agent"]})]},U.path))]})]})}function qO({template:e,initialDest:t,recentDirs:i,listDir:r,onCancel:o,onConfirm:c,triggerRef:f}){const[l,d]=z.useState(t),[m,y]=z.useState(!1),[v,S]=z.useState(null),w=z.useRef(null);xo(!m,{onDismiss:o,containerRef:w,triggerRef:f});const R=async()=>{const x=l.trim();if(!(!x||m)){y(!0),S(null);try{await c(x)}catch(g){S(g.message),y(!1)}}};return h.jsx("div",{className:"modal-backdrop",children:h.jsxs("div",{className:"modal modal-confirm modal-template-use",role:"dialog","aria-label":`Use ${e.name}`,...$t({dialog:"template_use"}),"data-testid":"template-use-dialog",ref:w,children:[h.jsxs("div",{className:"modal-header",children:["Use ",e.name,h.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",disabled:m,onClick:o,children:h.jsx(de,{name:"X",size:14})})]}),h.jsxs("div",{className:"modal-body",children:[h.jsx(k2,{value:l,onChange:d,onSubmit:()=>void R(),recentDirs:i,listDir:r}),v?h.jsx("p",{className:"modal-error","data-testid":"template-use-error",children:v}):h.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."})]}),h.jsxs("div",{className:"modal-actions",children:[h.jsx("button",{className:"btn-ghost",disabled:m,onClick:o,children:"Cancel"}),h.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"template-use-confirm",disabled:m||!l.trim(),onClick:()=>void R(),children:m?"Starting…":"Start session"})]})]})})}function A2({children:e,...t}){return h.jsx("div",{style:{display:"contents"},...$t(t),children:e})}function FO({projectRoot:e,recentDirs:t,listDir:i,onExit:r,onUse:o,listTemplates:c,getTemplate:f,openTemplateId:l}){const[d,m]=z.useState(null),[y,v]=z.useState(null),[S,w]=z.useState(ww),[R,x]=z.useState(null),[g,b]=z.useState(null),p=z.useRef(null);z.useEffect(()=>{let M=!1;return c().then(O=>{M||m(O)}).catch(O=>{M||v(O instanceof Error?O.message:String(O))}),()=>{M=!0}},[]);const _=z.useMemo(()=>((d==null?void 0:d.templates)??[]).map(M=>({...M,kind:"gallery"})),[d]),k=z.useMemo(()=>$O(_,S,B1),[_,S]),A=z.useMemo(()=>S.category!==null||S.cadence!==null?[]:vh.filter(M=>B1(M,S.query)),[S]),C=z.useRef(null);z.useEffect(()=>{if(!l||C.current===l)return;const M=_.find(O=>O.id===l)??vh.find(O=>O.id===l);M&&(C.current=l,x(M))},[l,_]);const N=d===null&&y===null,j=y?`Could not load the template gallery: ${y}`:!d||d.source==="live"?null:d.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 h.jsxs("section",{className:"templates-panel","data-testid":"templates-panel","aria-label":"Templates",children:[h.jsxs("div",{className:"templates-bar",...$t({surface:"template_gallery"}),children:[h.jsx("button",{type:"button",className:"theme-toggle templates-back","data-testid":R?"template-detail-back":"templates-exit","aria-label":R?"Back to all templates":"Back to the session",title:R?"All templates":"Back to the session",onClick:()=>R?x(null):r(),children:h.jsx(de,{name:"ArrowLeft",size:14})}),h.jsx("span",{className:"templates-bar-title",children:R?R.name:"Templates"}),R&&h.jsx("button",{ref:p,type:"button",className:"btn-primary templates-bar-use","data-testid":"template-use-btn",onClick:()=>b(R),children:"Use template"})]}),h.jsx("div",{className:"templates-scroll",children:h.jsx("div",{className:"templates-measure",children:R?h.jsx(HO,{template:R,getTemplate:f}):h.jsxs(A2,{surface:"template_gallery",children:[h.jsxs("header",{className:"templates-hero",children:[h.jsx("h2",{className:"templates-hero-title",children:"Start from a template"}),h.jsx("p",{className:"templates-hero-copy",children:N?"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&&h.jsxs("div",{className:"templates-degraded","data-testid":"templates-degraded",role:"status",children:[h.jsx(de,{name:"TriangleAlert",size:14}),h.jsx("span",{children:j})]}),h.jsxs("div",{className:"templates-layout",children:[h.jsx(zO,{catalog:_,filter:S,onChange:w}),h.jsxs("div",{className:"templates-results",children:[k.length>0&&h.jsx("div",{className:"templates-grid","data-testid":"templates-grid",children:k.map(M=>h.jsx(Ew,{template:M,onOpen:x,onUse:b},M.id))}),k.length===0&&!N&&_.length>0&&h.jsx(Zi,{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:NO(S)?h.jsx("button",{type:"button",className:"btn-line","data-testid":"templates-empty-clear",onClick:()=>w(ww),children:"Clear filters"}):void 0}),A.length>0&&h.jsxs("section",{className:"templates-starters","data-testid":"templates-starters",children:[h.jsx("span",{className:"facet-title",children:"Bundled starters"}),h.jsx("p",{className:"templates-starters-copy",children:"Shipped with the CLI. No Sapiom account or capability spend; setup may access npm."}),h.jsx("div",{className:"templates-grid",children:A.map(M=>h.jsx(Ew,{template:M,onOpen:x,onUse:b},M.id))})]})]})]})]})})}),g&&h.jsx(qO,{template:g,initialDest:g5(g,e),recentDirs:t,listDir:i,onCancel:()=>b(null),triggerRef:p,onConfirm:async M=>{await o(M,g),r()}})]})}var Om={exports:{}},Aw;function VO(){return Aw||(Aw=1,(function(e,t){(function(i,r){e.exports=r()})(globalThis,(()=>(()=>{var i={4567:function(f,l,d){var m=this&&this.__decorate||function(p,_,k,A){var C,N=arguments.length,j=N<3?_:A===null?A=Object.getOwnPropertyDescriptor(_,k):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(p,_,k,A);else for(var M=p.length-1;M>=0;M--)(C=p[M])&&(j=(N<3?C(j):N>3?C(_,k,j):C(_,k))||j);return N>3&&j&&Object.defineProperty(_,k,j),j},y=this&&this.__param||function(p,_){return function(k,A){_(k,A,p)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const v=d(9042),S=d(9924),w=d(844),R=d(4725),x=d(2585),g=d(3656);let b=l.AccessibilityManager=class extends w.Disposable{constructor(p,_,k,A){super(),this._terminal=p,this._coreBrowserService=k,this._renderService=A,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 C=0;C<this._terminal.rows;C++)this._rowElements[C]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[C]);if(this._topBoundaryFocusListener=C=>this._handleBoundaryFocus(C,0),this._bottomBoundaryFocusListener=C=>this._handleBoundaryFocus(C,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((C=>this._handleResize(C.rows)))),this.register(this._terminal.onRender((C=>this._refreshRows(C.start,C.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((C=>this._handleChar(C)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
479
+ `)))),this.register(this._terminal.onA11yTab((C=>this._handleTab(C)))),this.register(this._terminal.onKey((C=>this._handleKey(C.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,g.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,w.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(p){for(let _=0;_<p;_++)this._handleChar(" ")}_handleChar(p){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==p&&(this._charsToAnnounce+=p):this._charsToAnnounce+=p,p===`
480
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=v.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(p){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(p)||this._charsToConsume.push(p)}_refreshRows(p,_){this._liveRegionDebouncer.refresh(p,_,this._terminal.rows)}_renderRows(p,_){const k=this._terminal.buffer,A=k.lines.length.toString();for(let C=p;C<=_;C++){const N=k.lines.get(k.ydisp+C),j=[],M=(N==null?void 0:N.translateToString(!0,void 0,void 0,j))||"",O=(k.ydisp+C+1).toString(),B=this._rowElements[C];B&&(M.length===0?(B.innerText=" ",this._rowColumns.set(B,[0,1])):(B.textContent=M,this._rowColumns.set(B,j)),B.setAttribute("aria-posinset",O),B.setAttribute("aria-setsize",A))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(p,_){const k=p.target,A=this._rowElements[_===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(_===0?"1":`${this._terminal.buffer.lines.length}`)||p.relatedTarget!==A)return;let C,N;if(_===0?(C=k,N=this._rowElements.pop(),this._rowContainer.removeChild(N)):(C=this._rowElements.shift(),N=k,this._rowContainer.removeChild(C)),C.removeEventListener("focus",this._topBoundaryFocusListener),N.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(),p.preventDefault(),p.stopImmediatePropagation()}_handleSelectionChange(){var M;if(this._rowElements.length===0)return;const p=document.getSelection();if(!p)return;if(p.isCollapsed)return void(this._rowContainer.contains(p.anchorNode)&&this._terminal.clearSelection());if(!p.anchorNode||!p.focusNode)return void console.error("anchorNode and/or focusNode are null");let _={node:p.anchorNode,offset:p.anchorOffset},k={node:p.focusNode,offset:p.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 A=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(A)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:A,offset:((M=A.textContent)==null?void 0:M.length)??0}),!this._rowContainer.contains(k.node))return;const C=({node:O,offset:B})=>{const q=O instanceof Text?O.parentNode:O;let V=parseInt(q==null?void 0:q.getAttribute("aria-posinset"),10)-1;if(isNaN(V))return console.warn("row is invalid. Race condition?"),null;const J=this._rowColumns.get(q);if(!J)return console.warn("columns is null. Race condition?"),null;let ee=B<J.length?J[B]:J.slice(-1)[0]+1;return ee>=this._terminal.cols&&(++V,ee=0),{row:V,column:ee}},N=C(_),j=C(k);if(N&&j){if(N.row>j.row||N.row===j.row&&N.column>=j.column)throw new Error("invalid range");this._terminal.select(N.column,N.row,(j.row-N.row)*this._terminal.cols-N.column+j.column)}}_handleResize(p){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>p;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const p=this._coreBrowserService.mainDocument.createElement("div");return p.setAttribute("role","listitem"),p.tabIndex=-1,this._refreshRowDimensions(p),p}_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 p=0;p<this._terminal.rows;p++)this._refreshRowDimensions(this._rowElements[p])}}_refreshRowDimensions(p){p.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=b=m([y(1,x.IInstantiationService),y(2,R.ICoreBrowserService),y(3,R.IRenderService)],b)},3614:(f,l)=>{function d(S){return S.replace(/\r?\n/g,"\r")}function m(S,w){return w?"\x1B[200~"+S+"\x1B[201~":S}function y(S,w,R,x){S=m(S=d(S),R.decPrivateModes.bracketedPasteMode&&x.rawOptions.ignoreBracketedPasteMode!==!0),R.triggerDataEvent(S,!0),w.value=""}function v(S,w,R){const x=R.getBoundingClientRect(),g=S.clientX-x.left-10,b=S.clientY-x.top-10;w.style.width="20px",w.style.height="20px",w.style.left=`${g}px`,w.style.top=`${b}px`,w.style.zIndex="1000",w.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=d,l.bracketTextForPaste=m,l.copyHandler=function(S,w){S.clipboardData&&S.clipboardData.setData("text/plain",w.selectionText),S.preventDefault()},l.handlePasteEvent=function(S,w,R,x){S.stopPropagation(),S.clipboardData&&y(S.clipboardData.getData("text/plain"),w,R,x)},l.paste=y,l.moveTextAreaUnderMouseCursor=v,l.rightClickHandler=function(S,w,R,x,g){v(S,w,R),g&&x.rightClickSelect(S),w.value=x.selectionText,w.select()}},7239:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const m=d(1505);l.ColorContrastCache=class{constructor(){this._color=new m.TwoKeyMap,this._css=new m.TwoKeyMap}setCss(y,v,S){this._css.set(y,v,S)}getCss(y,v){return this._css.get(y,v)}setColor(y,v,S){this._color.set(y,v,S)}getColor(y,v){return this._color.get(y,v)}clear(){this._color.clear(),this._css.clear()}}},3656:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(d,m,y,v){d.addEventListener(m,y,v);let S=!1;return{dispose:()=>{S||(S=!0,d.removeEventListener(m,y,v))}}}},3551:function(f,l,d){var m=this&&this.__decorate||function(b,p,_,k){var A,C=arguments.length,N=C<3?p:k===null?k=Object.getOwnPropertyDescriptor(p,_):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,p,_,k);else for(var j=b.length-1;j>=0;j--)(A=b[j])&&(N=(C<3?A(N):C>3?A(p,_,N):A(p,_))||N);return C>3&&N&&Object.defineProperty(p,_,N),N},y=this&&this.__param||function(b,p){return function(_,k){p(_,k,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const v=d(3656),S=d(8460),w=d(844),R=d(2585),x=d(4725);let g=l.Linkifier=class extends w.Disposable{get currentLink(){return this._currentLink}constructor(b,p,_,k,A){super(),this._element=b,this._mouseService=p,this._renderService=_,this._bufferService=k,this._linkProviderService=A,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,w.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,w.toDisposable)((()=>{var C;this._lastMouseEvent=void 0,(C=this._activeProviderReplies)==null||C.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,v.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,v.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,v.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,v.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(b){this._lastMouseEvent=b;const p=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!p)return;this._isMouseOut=!1;const _=b.composedPath();for(let k=0;k<_.length;k++){const A=_[k];if(A.classList.contains("xterm"))break;if(A.classList.contains("xterm-hover"))return}this._lastBufferCell&&p.x===this._lastBufferCell.x&&p.y===this._lastBufferCell.y||(this._handleHover(p),this._lastBufferCell=p)}_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,p){var k,A;this._activeProviderReplies&&p||((k=this._activeProviderReplies)==null||k.forEach((C=>{C==null||C.forEach((N=>{N.link.dispose&&N.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let _=!1;for(const[C,N]of this._linkProviderService.linkProviders.entries())p?(A=this._activeProviderReplies)!=null&&A.get(C)&&(_=this._checkLinkProviderResult(C,b,_)):N.provideLinks(b.y,(j=>{var O,B;if(this._isMouseOut)return;const M=j==null?void 0:j.map((q=>({link:q})));(O=this._activeProviderReplies)==null||O.set(C,M),_=this._checkLinkProviderResult(C,b,_),((B=this._activeProviderReplies)==null?void 0:B.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,p){const _=new Set;for(let k=0;k<p.size;k++){const A=p.get(k);if(A)for(let C=0;C<A.length;C++){const N=A[C],j=N.link.range.start.y<b?0:N.link.range.start.x,M=N.link.range.end.y>b?this._bufferService.cols:N.link.range.end.x;for(let O=j;O<=M;O++){if(_.has(O)){A.splice(C--,1);break}_.add(O)}}}}_checkLinkProviderResult(b,p,_){var C;if(!this._activeProviderReplies)return _;const k=this._activeProviderReplies.get(b);let A=!1;for(let N=0;N<b;N++)this._activeProviderReplies.has(N)&&!this._activeProviderReplies.get(N)||(A=!0);if(!A&&k){const N=k.find((j=>this._linkAtPosition(j.link,p)));N&&(_=!0,this._handleNewLink(N))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!_)for(let N=0;N<this._activeProviderReplies.size;N++){const j=(C=this._activeProviderReplies.get(N))==null?void 0:C.find((M=>this._linkAtPosition(M.link,p)));if(j){_=!0,this._handleNewLink(j);break}}return _}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const p=this._positionFromMouseEvent(b,this._element,this._mouseService);p&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,p)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,p){this._currentLink&&this._lastMouseEvent&&(!b||!p||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=p)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,w.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._lastMouseEvent)return;const p=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);p&&this._linkAtPosition(b.link,p)&&(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,A,C;(k=this._currentLink)!=null&&k.state&&((C=(A=this._currentLink)==null?void 0:A.state)==null?void 0:C.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,A=this._bufferService.buffer.ydisp+1+_.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=A&&(this._clearCurrentLink(k,A),this._lastMouseEvent)){const C=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);C&&this._askForLink(C,!1)}}))))}_linkHover(b,p,_){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(p,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),p.hover&&p.hover(_,p.text)}_fireUnderlineEvent(b,p){const _=b.range,k=this._bufferService.buffer.ydisp,A=this._createLinkUnderlineEvent(_.start.x-1,_.start.y-k-1,_.end.x,_.end.y-k-1,void 0);(p?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(A)}_linkLeave(b,p,_){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(p,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),p.leave&&p.leave(_,p.text)}_linkAtPosition(b,p){const _=b.range.start.y*this._bufferService.cols+b.range.start.x,k=b.range.end.y*this._bufferService.cols+b.range.end.x,A=p.y*this._bufferService.cols+p.x;return _<=A&&A<=k}_positionFromMouseEvent(b,p,_){const k=_.getCoords(b,p,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,p,_,k,A){return{x1:b,y1:p,x2:_,y2:k,cols:this._bufferService.cols,fg:A}}};l.Linkifier=g=m([y(1,x.IMouseService),y(2,x.IRenderService),y(3,R.IBufferService),y(4,x.ILinkProviderService)],g)},9042:(f,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(f,l,d){var m=this&&this.__decorate||function(x,g,b,p){var _,k=arguments.length,A=k<3?g:p===null?p=Object.getOwnPropertyDescriptor(g,b):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,g,b,p);else for(var C=x.length-1;C>=0;C--)(_=x[C])&&(A=(k<3?_(A):k>3?_(g,b,A):_(g,b))||A);return k>3&&A&&Object.defineProperty(g,b,A),A},y=this&&this.__param||function(x,g){return function(b,p){g(b,p,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const v=d(511),S=d(2585);let w=l.OscLinkProvider=class{constructor(x,g,b){this._bufferService=x,this._optionsService=g,this._oscLinkService=b}provideLinks(x,g){var M;const b=this._bufferService.buffer.lines.get(x-1);if(!b)return void g(void 0);const p=[],_=this._optionsService.rawOptions.linkHandler,k=new v.CellData,A=b.getTrimmedLength();let C=-1,N=-1,j=!1;for(let O=0;O<A;O++)if(N!==-1||b.hasContent(O)){if(b.loadCell(O,k),k.hasExtendedAttrs()&&k.extended.urlId){if(N===-1){N=O,C=k.extended.urlId;continue}j=k.extended.urlId!==C}else N!==-1&&(j=!0);if(j||N!==-1&&O===A-1){const B=(M=this._oscLinkService.getLinkData(C))==null?void 0:M.uri;if(B){const q={start:{x:N+1,y:x},end:{x:O+(j||O!==A-1?0:1),y:x}};let V=!1;if(!(_!=null&&_.allowNonHttpProtocols))try{const J=new URL(B);["http:","https:"].includes(J.protocol)||(V=!0)}catch{V=!0}V||p.push({text:B,range:q,activate:(J,ee)=>_?_.activate(J,ee,q):R(0,ee),hover:(J,ee)=>{var W;return(W=_==null?void 0:_.hover)==null?void 0:W.call(_,J,ee,q)},leave:(J,ee)=>{var W;return(W=_==null?void 0:_.leave)==null?void 0:W.call(_,J,ee,q)}})}j=!1,k.hasExtendedAttrs()&&k.extended.urlId?(N=O,C=k.extended.urlId):(N=-1,C=-1)}}g(p)}};function R(x,g){if(confirm(`Do you want to navigate to ${g}?
481
+
482
+ WARNING: This link could potentially be dangerous`)){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=g}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=w=m([y(0,S.IBufferService),y(1,S.IOptionsService),y(2,S.IOscLinkService)],w)},6193:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.RenderDebouncer=class{constructor(d,m){this._renderCallback=d,this._coreBrowserService=m,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(d){return this._refreshCallbacks.push(d),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(d,m,y){this._rowCount=y,d=d!==void 0?d:0,m=m!==void 0?m:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,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 d=Math.max(this._rowStart,0),m=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,m),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const d of this._refreshCallbacks)d(0);this._refreshCallbacks=[]}}},3236:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const m=d(3614),y=d(3656),v=d(3551),S=d(9042),w=d(3730),R=d(1680),x=d(3107),g=d(5744),b=d(2950),p=d(1296),_=d(428),k=d(4269),A=d(5114),C=d(8934),N=d(3230),j=d(9312),M=d(4725),O=d(6731),B=d(8055),q=d(8969),V=d(8460),J=d(844),ee=d(6114),W=d(8437),Q=d(2584),ie=d(7399),I=d(5941),P=d(9074),D=d(2585),H=d(5435),U=d(4567),L=d(779);class G 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(Y={}){super(Y),this.browser=ee,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new J.MutableDisposable),this._onCursorMove=this.register(new V.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new V.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new V.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new V.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new V.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new V.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new V.EventEmitter),this._onBlur=this.register(new V.EventEmitter),this._onA11yCharEmitter=this.register(new V.EventEmitter),this._onA11yTabEmitter=this.register(new V.EventEmitter),this._onWillOpen=this.register(new V.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(P.DecorationService),this._instantiationService.setService(D.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(L.LinkProviderService),this._instantiationService.setService(M.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(w.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((F,le)=>this.refresh(F,le)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((F=>this._reportWindowsOptions(F)))),this.register(this._inputHandler.onColor((F=>this._handleColorEvent(F)))),this.register((0,V.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,V.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,V.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,V.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((F=>this._afterResize(F.cols,F.rows)))),this.register((0,J.toDisposable)((()=>{var F,le;this._customKeyEventHandler=void 0,(le=(F=this.element)==null?void 0:F.parentNode)==null||le.removeChild(this.element)})))}_handleColorEvent(Y){if(this._themeService)for(const F of Y){let le,ae="";switch(F.index){case 256:le="foreground",ae="10";break;case 257:le="background",ae="11";break;case 258:le="cursor",ae="12";break;default:le="ansi",ae="4;"+F.index}switch(F.type){case 0:const X=B.color.toColorRGB(le==="ansi"?this._themeService.colors.ansi[F.index]:this._themeService.colors[le]);this.coreService.triggerDataEvent(`${Q.C0.ESC}]${ae};${(0,I.toRgbString)(X)}${Q.C1_ESCAPED.ST}`);break;case 1:if(le==="ansi")this._themeService.modifyColors((te=>te.ansi[F.index]=B.channels.toColor(...F.color)));else{const te=le;this._themeService.modifyColors((ue=>ue[te]=B.channels.toColor(...F.color)))}break;case 2:this._themeService.restoreColor(F.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Y){Y?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Y){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var Y;return(Y=this.textarea)==null?void 0:Y.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const Y=this.buffer.ybase+this.buffer.y,F=this.buffer.lines.get(Y);if(!F)return;const le=Math.min(this.buffer.x,this.cols-1),ae=this._renderService.dimensions.css.cell.height,X=F.getWidth(le),te=this._renderService.dimensions.css.cell.width*X,ue=this.buffer.y*this._renderService.dimensions.css.cell.height,me=le*this._renderService.dimensions.css.cell.width;this.textarea.style.left=me+"px",this.textarea.style.top=ue+"px",this.textarea.style.width=te+"px",this.textarea.style.height=ae+"px",this.textarea.style.lineHeight=ae+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,y.addDisposableDomListener)(this.element,"copy",(F=>{this.hasSelection()&&(0,m.copyHandler)(F,this._selectionService)})));const Y=F=>(0,m.handlePasteEvent)(F,this.textarea,this.coreService,this.optionsService);this.register((0,y.addDisposableDomListener)(this.textarea,"paste",Y)),this.register((0,y.addDisposableDomListener)(this.element,"paste",Y)),ee.isFirefox?this.register((0,y.addDisposableDomListener)(this.element,"mousedown",(F=>{F.button===2&&(0,m.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,y.addDisposableDomListener)(this.element,"contextmenu",(F=>{(0,m.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),ee.isLinux&&this.register((0,y.addDisposableDomListener)(this.element,"auxclick",(F=>{F.button===1&&(0,m.moveTextAreaUnderMouseCursor)(F,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,y.addDisposableDomListener)(this.textarea,"keyup",(Y=>this._keyUp(Y)),!0)),this.register((0,y.addDisposableDomListener)(this.textarea,"keydown",(Y=>this._keyDown(Y)),!0)),this.register((0,y.addDisposableDomListener)(this.textarea,"keypress",(Y=>this._keyPress(Y)),!0)),this.register((0,y.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,y.addDisposableDomListener)(this.textarea,"compositionupdate",(Y=>this._compositionHelper.compositionupdate(Y)))),this.register((0,y.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,y.addDisposableDomListener)(this.textarea,"input",(Y=>this._inputEvent(Y)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Y){var le;if(!Y)throw new Error("Terminal requires a parent element.");if(Y.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((le=this.element)==null?void 0:le.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Y.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),Y.appendChild(this.element);const F=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),F.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,y.addDisposableDomListener)(this.screenElement,"mousemove",(ae=>this.updateCursorStyle(ae)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),F.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",S.promptLabel),ee.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(A.CoreBrowserService,this.textarea,Y.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(M.ICoreBrowserService,this._coreBrowserService),this.register((0,y.addDisposableDomListener)(this.textarea,"focus",(ae=>this._handleTextAreaFocus(ae)))),this.register((0,y.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(O.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(N.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(M.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ae=>this._onRender.fire(ae)))),this.onResize((ae=>this._renderService.resize(ae.cols,ae.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(b.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(C.MouseService),this._instantiationService.setService(M.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(v.Linkifier,this.screenElement)),this.element.appendChild(F);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(R.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ae=>this.scrollLines(ae.amount,ae.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(j.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(M.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ae=>this.scrollLines(ae.amount,ae.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ae=>this._renderService.handleSelectionChanged(ae.start,ae.end,ae.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ae=>{this.textarea.value=ae,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ae=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,y.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(x.BufferDecorationRenderer,this.screenElement)),this.register((0,y.addDisposableDomListener)(this.element,"mousedown",(ae=>this._selectionService.handleMouseDown(ae)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ae=>this._handleScreenReaderModeOptionChange(ae)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(g.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ae=>{!this._overviewRulerRenderer&&ae&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(g.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(p.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Y=this,F=this.element;function le(te){const ue=Y._mouseService.getMouseReportCoords(te,Y.screenElement);if(!ue)return!1;let me,je;switch(te.overrideType||te.type){case"mousemove":je=32,te.buttons===void 0?(me=3,te.button!==void 0&&(me=te.button<3?te.button:3)):me=1&te.buttons?0:4&te.buttons?1:2&te.buttons?2:3;break;case"mouseup":je=0,me=te.button<3?te.button:3;break;case"mousedown":je=1,me=te.button<3?te.button:3;break;case"wheel":if(Y._customWheelEventHandler&&Y._customWheelEventHandler(te)===!1||Y.viewport.getLinesScrolled(te)===0)return!1;je=te.deltaY<0?0:1,me=4;break;default:return!1}return!(je===void 0||me===void 0||me>4)&&Y.coreMouseService.triggerMouseEvent({col:ue.col,row:ue.row,x:ue.x,y:ue.y,button:me,action:je,ctrl:te.ctrlKey,alt:te.altKey,shift:te.shiftKey})}const ae={mouseup:null,wheel:null,mousedrag:null,mousemove:null},X={mouseup:te=>(le(te),te.buttons||(this._document.removeEventListener("mouseup",ae.mouseup),ae.mousedrag&&this._document.removeEventListener("mousemove",ae.mousedrag)),this.cancel(te)),wheel:te=>(le(te),this.cancel(te,!0)),mousedrag:te=>{te.buttons&&le(te)},mousemove:te=>{te.buttons||le(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?ae.mousemove||(F.addEventListener("mousemove",X.mousemove),ae.mousemove=X.mousemove):(F.removeEventListener("mousemove",ae.mousemove),ae.mousemove=null),16&te?ae.wheel||(F.addEventListener("wheel",X.wheel,{passive:!1}),ae.wheel=X.wheel):(F.removeEventListener("wheel",ae.wheel),ae.wheel=null),2&te?ae.mouseup||(ae.mouseup=X.mouseup):(this._document.removeEventListener("mouseup",ae.mouseup),ae.mouseup=null),4&te?ae.mousedrag||(ae.mousedrag=X.mousedrag):(this._document.removeEventListener("mousemove",ae.mousedrag),ae.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,y.addDisposableDomListener)(F,"mousedown",(te=>{if(te.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(te))return le(te),ae.mouseup&&this._document.addEventListener("mouseup",ae.mouseup),ae.mousedrag&&this._document.addEventListener("mousemove",ae.mousedrag),this.cancel(te)}))),this.register((0,y.addDisposableDomListener)(F,"wheel",(te=>{if(!ae.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(te)===!1)return!1;if(!this.buffer.hasScrollback){const ue=this.viewport.getLinesScrolled(te);if(ue===0)return;const me=Q.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(te.deltaY<0?"A":"B");let je="";for(let Oe=0;Oe<Math.abs(ue);Oe++)je+=me;return this.coreService.triggerDataEvent(je,!0),this.cancel(te,!0)}return this.viewport.handleWheel(te)?this.cancel(te):void 0}}),{passive:!1})),this.register((0,y.addDisposableDomListener)(F,"touchstart",(te=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(te),this.cancel(te)}),{passive:!0})),this.register((0,y.addDisposableDomListener)(F,"touchmove",(te=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(te)?void 0:this.cancel(te)}),{passive:!1}))}refresh(Y,F){var le;(le=this._renderService)==null||le.refreshRows(Y,F)}updateCursorStyle(Y){var F;(F=this._selectionService)!=null&&F.shouldColumnSelect(Y)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(Y,F,le=0){var ae;le===1?(super.scrollLines(Y,F,le),this.refresh(0,this.rows-1)):(ae=this.viewport)==null||ae.scrollLines(Y)}paste(Y){(0,m.paste)(Y,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Y){this._customKeyEventHandler=Y}attachCustomWheelEventHandler(Y){this._customWheelEventHandler=Y}registerLinkProvider(Y){return this._linkProviderService.registerLinkProvider(Y)}registerCharacterJoiner(Y){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const F=this._characterJoinerService.register(Y);return this.refresh(0,this.rows-1),F}deregisterCharacterJoiner(Y){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Y)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Y){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Y)}registerDecoration(Y){return this._decorationService.registerDecoration(Y)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Y,F,le){this._selectionService.setSelection(Y,F,le)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var Y;(Y=this._selectionService)==null||Y.clearSelection()}selectAll(){var Y;(Y=this._selectionService)==null||Y.selectAll()}selectLines(Y,F){var le;(le=this._selectionService)==null||le.selectLines(Y,F)}_keyDown(Y){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1)return!1;const F=this.browser.isMac&&this.options.macOptionIsMeta&&Y.altKey;if(!F&&!this._compositionHelper.keydown(Y))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;F||Y.key!=="Dead"&&Y.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const le=(0,ie.evaluateKeyboardEvent)(Y,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Y),le.type===3||le.type===2){const ae=this.rows-1;return this.scrollLines(le.type===2?-ae:ae),this.cancel(Y,!0)}return le.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Y)||(le.cancel&&this.cancel(Y,!0),!le.key||!!(Y.key&&!Y.ctrlKey&&!Y.altKey&&!Y.metaKey&&Y.key.length===1&&Y.key.charCodeAt(0)>=65&&Y.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(le.key!==Q.C0.ETX&&le.key!==Q.C0.CR||(this.textarea.value=""),this._onKey.fire({key:le.key,domEvent:Y}),this._showCursor(),this.coreService.triggerDataEvent(le.key,!0),!this.optionsService.rawOptions.screenReaderMode||Y.altKey||Y.ctrlKey?this.cancel(Y,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Y,F){const le=Y.isMac&&!this.options.macOptionIsMeta&&F.altKey&&!F.ctrlKey&&!F.metaKey||Y.isWindows&&F.altKey&&F.ctrlKey&&!F.metaKey||Y.isWindows&&F.getModifierState("AltGraph");return F.type==="keypress"?le:le&&(!F.keyCode||F.keyCode>47)}_keyUp(Y){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1||((function(F){return F.keyCode===16||F.keyCode===17||F.keyCode===18})(Y)||this.focus(),this.updateCursorStyle(Y),this._keyPressHandled=!1)}_keyPress(Y){let F;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Y)===!1)return!1;if(this.cancel(Y),Y.charCode)F=Y.charCode;else if(Y.which===null||Y.which===void 0)F=Y.keyCode;else{if(Y.which===0||Y.charCode===0)return!1;F=Y.which}return!(!F||(Y.altKey||Y.ctrlKey||Y.metaKey)&&!this._isThirdLevelShift(this.browser,Y)||(F=String.fromCharCode(F),this._onKey.fire({key:F,domEvent:Y}),this._showCursor(),this.coreService.triggerDataEvent(F,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Y){if(Y.data&&Y.inputType==="insertText"&&(!Y.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const F=Y.data;return this.coreService.triggerDataEvent(F,!0),this.cancel(Y),!0}return!1}resize(Y,F){Y!==this.cols||F!==this.rows?super.resize(Y,F):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Y,F){var le,ae;(le=this._charSizeService)==null||le.measure(),(ae=this.viewport)==null||ae.syncScrollArea(!0)}clear(){var Y;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let F=1;F<this.rows;F++)this.buffer.lines.push(this.buffer.getBlankLine(W.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(Y=this.viewport)==null||Y.reset(),this.refresh(0,this.rows-1)}}reset(){var F,le;this.options.rows=this.rows,this.options.cols=this.cols;const Y=this._customKeyEventHandler;this._setup(),super.reset(),(F=this._selectionService)==null||F.reset(),this._decorationService.reset(),(le=this.viewport)==null||le.reset(),this._customKeyEventHandler=Y,this.refresh(0,this.rows-1)}clearTextureAtlas(){var Y;(Y=this._renderService)==null||Y.clearTextureAtlas()}_reportFocus(){var Y;(Y=this.element)!=null&&Y.classList.contains("focus")?this.coreService.triggerDataEvent(Q.C0.ESC+"[I"):this.coreService.triggerDataEvent(Q.C0.ESC+"[O")}_reportWindowsOptions(Y){if(this._renderService)switch(Y){case H.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const F=this._renderService.dimensions.css.canvas.width.toFixed(0),le=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.C0.ESC}[4;${le};${F}t`);break;case H.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const ae=this._renderService.dimensions.css.cell.width.toFixed(0),X=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.C0.ESC}[6;${X};${ae}t`)}}cancel(Y,F){if(this.options.cancelEvents||F)return Y.preventDefault(),Y.stopPropagation(),!1}}l.Terminal=G},9924:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.TimeBasedDebouncer=class{constructor(d,m=1e3){this._renderCallback=d,this._debounceThresholdMS=m,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(d,m,y){this._rowCount=y,d=d!==void 0?d:0,m=m!==void 0?m:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,m):m;const v=Date.now();if(v-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=v,this._innerRefresh();else if(!this._additionalRefreshRequested){const S=v-this._lastRefreshMs,w=this._debounceThresholdMS-S;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),w)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const d=Math.max(this._rowStart,0),m=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,m)}}},1680:function(f,l,d){var m=this&&this.__decorate||function(b,p,_,k){var A,C=arguments.length,N=C<3?p:k===null?k=Object.getOwnPropertyDescriptor(p,_):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,p,_,k);else for(var j=b.length-1;j>=0;j--)(A=b[j])&&(N=(C<3?A(N):C>3?A(p,_,N):A(p,_))||N);return C>3&&N&&Object.defineProperty(p,_,N),N},y=this&&this.__param||function(b,p){return function(_,k){p(_,k,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const v=d(3656),S=d(4725),w=d(8460),R=d(844),x=d(2585);let g=l.Viewport=class extends R.Disposable{constructor(b,p,_,k,A,C,N,j){super(),this._viewportElement=b,this._scrollArea=p,this._bufferService=_,this._optionsService=k,this._charSizeService=A,this._renderService=C,this._coreBrowserService=N,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 w.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,v.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 p=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==p&&(this._lastRecordedBufferHeight=p,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 p=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:p,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,p){const _=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(p<0&&this._viewportElement.scrollTop!==0||p>0&&_<this._lastRecordedBufferHeight)||(b.cancelable&&b.preventDefault(),!1)}handleWheel(b){const p=this._getPixelsScrolled(b);return p!==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+p:this._smoothScrollState.target+=p,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=p,this._bubbleScroll(b,p))}scrollLines(b){if(b!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const p=b*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+p,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 p=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_LINE?p*=this._currentRowHeight:b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(p*=this._currentRowHeight*this._bufferService.rows),p}getBufferElements(b,p){var j;let _,k="";const A=[],C=p??this._bufferService.buffer.lines.length,N=this._bufferService.buffer.lines;for(let M=b;M<C;M++){const O=N.get(M);if(!O)continue;const B=(j=N.get(M+1))==null?void 0:j.isWrapped;if(k+=O.translateToString(!B),!B||M===N.length-1){const q=document.createElement("div");q.textContent=k,A.push(q),k.length>0&&(_=q),k=""}}return{bufferElements:A,cursorElement:_}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let p=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(p/=this._currentRowHeight+0,this._wheelPartialScroll+=p,p=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(p*=this._bufferService.rows),p}_applyScrollModifier(b,p){const _=this._optionsService.rawOptions.fastScrollModifier;return _==="alt"&&p.altKey||_==="ctrl"&&p.ctrlKey||_==="shift"&&p.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 p=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,p!==0&&(this._viewportElement.scrollTop+=p,this._bubbleScroll(b,p))}};l.Viewport=g=m([y(2,x.IBufferService),y(3,x.IOptionsService),y(4,S.ICharSizeService),y(5,S.IRenderService),y(6,S.ICoreBrowserService),y(7,S.IThemeService)],g)},3107:function(f,l,d){var m=this&&this.__decorate||function(x,g,b,p){var _,k=arguments.length,A=k<3?g:p===null?p=Object.getOwnPropertyDescriptor(g,b):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,g,b,p);else for(var C=x.length-1;C>=0;C--)(_=x[C])&&(A=(k<3?_(A):k>3?_(g,b,A):_(g,b))||A);return k>3&&A&&Object.defineProperty(g,b,A),A},y=this&&this.__param||function(x,g){return function(b,p){g(b,p,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const v=d(4725),S=d(844),w=d(2585);let R=l.BufferDecorationRenderer=class extends S.Disposable{constructor(x,g,b,p,_){super(),this._screenElement=x,this._bufferService=g,this._coreBrowserService=b,this._decorationService=p,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 x of this._decorationService.decorations)this._renderDecoration(x);this._dimensionsChanged=!1}_renderDecoration(x){this._refreshStyle(x),this._dimensionsChanged&&this._refreshXPosition(x)}_createElement(x){var p;const g=this._coreBrowserService.mainDocument.createElement("div");g.classList.add("xterm-decoration"),g.classList.toggle("xterm-decoration-top-layer",((p=x==null?void 0:x.options)==null?void 0:p.layer)==="top"),g.style.width=`${Math.round((x.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,g.style.height=(x.options.height||1)*this._renderService.dimensions.css.cell.height+"px",g.style.top=(x.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",g.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const b=x.options.x??0;return b&&b>this._bufferService.cols&&(g.style.display="none"),this._refreshXPosition(x,g),g}_refreshStyle(x){const g=x.marker.line-this._bufferService.buffers.active.ydisp;if(g<0||g>=this._bufferService.rows)x.element&&(x.element.style.display="none",x.onRenderEmitter.fire(x.element));else{let b=this._decorationElements.get(x);b||(b=this._createElement(x),x.element=b,this._decorationElements.set(x,b),this._container.appendChild(b),x.onDispose((()=>{this._decorationElements.delete(x),b.remove()}))),b.style.top=g*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",x.onRenderEmitter.fire(b)}}_refreshXPosition(x,g=x.element){if(!g)return;const b=x.options.x??0;(x.options.anchor||"left")==="right"?g.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":g.style.left=b?b*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(x){var g;(g=this._decorationElements.get(x))==null||g.remove(),this._decorationElements.delete(x),x.dispose()}};l.BufferDecorationRenderer=R=m([y(1,w.IBufferService),y(2,v.ICoreBrowserService),y(3,w.IDecorationService),y(4,v.IRenderService)],R)},5871:(f,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(d){if(d.options.overviewRulerOptions){for(const m of this._zones)if(m.color===d.options.overviewRulerOptions.color&&m.position===d.options.overviewRulerOptions.position){if(this._lineIntersectsZone(m,d.marker.line))return;if(this._lineAdjacentToZone(m,d.marker.line,d.options.overviewRulerOptions.position))return void this._addLineToZone(m,d.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=d.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=d.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=d.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=d.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:d.options.overviewRulerOptions.color,position:d.options.overviewRulerOptions.position,startBufferLine:d.marker.line,endBufferLine:d.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(d){this._linePadding=d}_lineIntersectsZone(d,m){return m>=d.startBufferLine&&m<=d.endBufferLine}_lineAdjacentToZone(d,m,y){return m>=d.startBufferLine-this._linePadding[y||"full"]&&m<=d.endBufferLine+this._linePadding[y||"full"]}_addLineToZone(d,m){d.startBufferLine=Math.min(d.startBufferLine,m),d.endBufferLine=Math.max(d.endBufferLine,m)}}},5744:function(f,l,d){var m=this&&this.__decorate||function(_,k,A,C){var N,j=arguments.length,M=j<3?k:C===null?C=Object.getOwnPropertyDescriptor(k,A):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(_,k,A,C);else for(var O=_.length-1;O>=0;O--)(N=_[O])&&(M=(j<3?N(M):j>3?N(k,A,M):N(k,A))||M);return j>3&&M&&Object.defineProperty(k,A,M),M},y=this&&this.__param||function(_,k){return function(A,C){k(A,C,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const v=d(5871),S=d(4725),w=d(844),R=d(2585),x={full:0,left:0,center:0,right:0},g={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0};let p=l.OverviewRulerRenderer=class extends w.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(_,k,A,C,N,j,M){var B;super(),this._viewportElement=_,this._screenElement=k,this._bufferService=A,this._decorationService=C,this._renderService=N,this._optionsService=j,this._coreBrowserService=M,this._colorZoneStore=new v.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(),(B=this._viewportElement.parentElement)==null||B.insertBefore(this._canvas,this._viewportElement);const O=this._canvas.getContext("2d");if(!O)throw new Error("Ctx cannot be null");this._ctx=O,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,w.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);g.full=this._canvas.width,g.left=_,g.center=k,g.right=_,this._refreshDrawHeightConstants(),b.full=0,b.left=0,b.center=g.left,b.right=g.left+g.center}_refreshDrawHeightConstants(){x.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);x.left=k,x.center=k,x.right=k}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*x.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*x.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*x.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*x.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)-x[_.position||"full"]/2),g[_.position||"full"],Math.round((this._canvas.height-1)*((_.endBufferLine-_.startBufferLine)/this._bufferService.buffers.active.lines.length)+x[_.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=p=m([y(2,R.IBufferService),y(3,R.IDecorationService),y(4,S.IRenderService),y(5,R.IOptionsService),y(6,S.ICoreBrowserService)],p)},2950:function(f,l,d){var m=this&&this.__decorate||function(x,g,b,p){var _,k=arguments.length,A=k<3?g:p===null?p=Object.getOwnPropertyDescriptor(g,b):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(x,g,b,p);else for(var C=x.length-1;C>=0;C--)(_=x[C])&&(A=(k<3?_(A):k>3?_(g,b,A):_(g,b))||A);return k>3&&A&&Object.defineProperty(g,b,A),A},y=this&&this.__param||function(x,g){return function(b,p){g(b,p,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const v=d(4725),S=d(2585),w=d(2584);let R=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(x,g,b,p,_,k){this._textarea=x,this._compositionView=g,this._bufferService=b,this._optionsService=p,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(x){this._compositionView.textContent=x.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(x){if(this._isComposing||this._isSendingComposition){if(x.keyCode===229||x.keyCode===16||x.keyCode===17||x.keyCode===18)return!1;this._finalizeComposition(!1)}return x.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(x){if(this._compositionView.classList.remove("active"),this._isComposing=!1,x){const g={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let b;this._isSendingComposition=!1,g.start+=this._dataAlreadySent.length,b=this._isComposing?this._textarea.value.substring(g.start,g.end):this._textarea.value.substring(g.start),b.length>0&&this._coreService.triggerDataEvent(b,!0)}}),0)}else{this._isSendingComposition=!1;const g=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(g,!0)}}_handleAnyTextareaChanges(){const x=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const g=this._textarea.value,b=g.replace(x,"");this._dataAlreadySent=b,g.length>x.length?this._coreService.triggerDataEvent(b,!0):g.length<x.length?this._coreService.triggerDataEvent(`${w.C0.DEL}`,!0):g.length===x.length&&g!==x&&this._coreService.triggerDataEvent(g,!0)}}),0)}updateCompositionElements(x){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const g=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),b=this._renderService.dimensions.css.cell.height,p=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,_=g*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=_+"px",this._compositionView.style.top=p+"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=p+"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"}x||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};l.CompositionHelper=R=m([y(2,S.IBufferService),y(3,S.IOptionsService),y(4,S.ICoreService),y(5,v.IRenderService)],R)},9806:(f,l)=>{function d(m,y,v){const S=v.getBoundingClientRect(),w=m.getComputedStyle(v),R=parseInt(w.getPropertyValue("padding-left")),x=parseInt(w.getPropertyValue("padding-top"));return[y.clientX-S.left-R,y.clientY-S.top-x]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=d,l.getCoords=function(m,y,v,S,w,R,x,g,b){if(!R)return;const p=d(m,y,v);return p?(p[0]=Math.ceil((p[0]+(b?x/2:0))/x),p[1]=Math.ceil(p[1]/g),p[0]=Math.min(Math.max(p[0],1),S+(b?1:0)),p[1]=Math.min(Math.max(p[1],1),w),p):void 0}},9504:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const m=d(2584);function y(g,b,p,_){const k=g-v(g,p),A=b-v(b,p),C=Math.abs(k-A)-(function(N,j,M){let O=0;const B=N-v(N,M),q=j-v(j,M);for(let V=0;V<Math.abs(B-q);V++){const J=S(N,j)==="A"?-1:1,ee=M.buffer.lines.get(B+J*V);ee!=null&&ee.isWrapped&&O++}return O})(g,b,p);return x(C,R(S(g,b),_))}function v(g,b){let p=0,_=b.buffer.lines.get(g),k=_==null?void 0:_.isWrapped;for(;k&&g>=0&&g<b.rows;)p++,_=b.buffer.lines.get(--g),k=_==null?void 0:_.isWrapped;return p}function S(g,b){return g>b?"A":"B"}function w(g,b,p,_,k,A){let C=g,N=b,j="";for(;C!==p||N!==_;)C+=k?1:-1,k&&C>A.cols-1?(j+=A.buffer.translateBufferLineToString(N,!1,g,C),C=0,g=0,N++):!k&&C<0&&(j+=A.buffer.translateBufferLineToString(N,!1,0,g+1),C=A.cols-1,g=C,N--);return j+A.buffer.translateBufferLineToString(N,!1,g,C)}function R(g,b){const p=b?"O":"[";return m.C0.ESC+p+g}function x(g,b){g=Math.floor(g);let p="";for(let _=0;_<g;_++)p+=b;return p}l.moveToCellSequence=function(g,b,p,_){const k=p.buffer.x,A=p.buffer.y;if(!p.buffer.hasScrollback)return(function(j,M,O,B,q,V){return y(M,B,q,V).length===0?"":x(w(j,M,j,M-v(M,q),!1,q).length,R("D",V))})(k,A,0,b,p,_)+y(A,b,p,_)+(function(j,M,O,B,q,V){let J;J=y(M,B,q,V).length>0?B-v(B,q):M;const ee=B,W=(function(Q,ie,I,P,D,H){let U;return U=y(I,P,D,H).length>0?P-v(P,D):ie,Q<I&&U<=P||Q>=I&&U<P?"C":"D"})(j,M,O,B,q,V);return x(w(j,J,O,ee,W==="C",q).length,R(W,V))})(k,A,g,b,p,_);let C;if(A===b)return C=k>g?"D":"C",x(Math.abs(k-g),R(C,_));C=A>b?"D":"C";const N=Math.abs(A-b);return x((function(j,M){return M.cols-j})(A>b?g:k,p)+(N-1)*p.cols+1+((A>b?k:g)-1),R(C,_))}},1296:function(f,l,d){var m=this&&this.__decorate||function(V,J,ee,W){var Q,ie=arguments.length,I=ie<3?J:W===null?W=Object.getOwnPropertyDescriptor(J,ee):W;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(V,J,ee,W);else for(var P=V.length-1;P>=0;P--)(Q=V[P])&&(I=(ie<3?Q(I):ie>3?Q(J,ee,I):Q(J,ee))||I);return ie>3&&I&&Object.defineProperty(J,ee,I),I},y=this&&this.__param||function(V,J){return function(ee,W){J(ee,W,V)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const v=d(3787),S=d(2550),w=d(2223),R=d(6171),x=d(6052),g=d(4725),b=d(8055),p=d(8460),_=d(844),k=d(2585),A="xterm-dom-renderer-owner-",C="xterm-rows",N="xterm-fg-",j="xterm-bg-",M="xterm-focus",O="xterm-selection";let B=1,q=l.DomRenderer=class extends _.Disposable{constructor(V,J,ee,W,Q,ie,I,P,D,H,U,L,G){super(),this._terminal=V,this._document=J,this._element=ee,this._screenElement=W,this._viewportElement=Q,this._helperContainer=ie,this._linkifier2=I,this._charSizeService=D,this._optionsService=H,this._bufferService=U,this._coreBrowserService=L,this._themeService=G,this._terminalClass=B++,this._rowElements=[],this._selectionRenderModel=(0,x.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new p.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(C),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(O),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,R.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=P.createInstance(v.DomRendererRowFactory,document),this._element.classList.add(A+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(A+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 V=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*V,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*V),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/V),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/V),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 ee of this._rowElements)ee.style.width=`${this.dimensions.css.canvas.width}px`,ee.style.height=`${this.dimensions.css.cell.height}px`,ee.style.lineHeight=`${this.dimensions.css.cell.height}px`,ee.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const J=`${this._terminalSelector} .${C} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=J,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(V){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let J=`${this._terminalSelector} .${C} { color: ${V.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;J+=`${this._terminalSelector} .${C} .xterm-dim { color: ${b.color.multiplyOpacity(V.foreground,.5).css};}`,J+=`${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 ee=`blink_underline_${this._terminalClass}`,W=`blink_bar_${this._terminalClass}`,Q=`blink_block_${this._terminalClass}`;J+=`@keyframes ${ee} { 50% { border-bottom-style: hidden; }}`,J+=`@keyframes ${W} { 50% { box-shadow: none; }}`,J+=`@keyframes ${Q} { 0% { background-color: ${V.cursor.css}; color: ${V.cursorAccent.css}; } 50% { background-color: inherit; color: ${V.cursor.css}; }}`,J+=`${this._terminalSelector} .${C}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${ee} 1s step-end infinite;}${this._terminalSelector} .${C}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${W} 1s step-end infinite;}${this._terminalSelector} .${C}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Q} 1s step-end infinite;}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-block { background-color: ${V.cursor.css}; color: ${V.cursorAccent.css};}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${V.cursor.css} !important; color: ${V.cursorAccent.css} !important;}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${V.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${V.cursor.css} inset;}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${V.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,J+=`${this._terminalSelector} .${O} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${O} div { position: absolute; background-color: ${V.selectionBackgroundOpaque.css};}${this._terminalSelector} .${O} div { position: absolute; background-color: ${V.selectionInactiveBackgroundOpaque.css};}`;for(const[ie,I]of V.ansi.entries())J+=`${this._terminalSelector} .${N}${ie} { color: ${I.css}; }${this._terminalSelector} .${N}${ie}.xterm-dim { color: ${b.color.multiplyOpacity(I,.5).css}; }${this._terminalSelector} .${j}${ie} { background-color: ${I.css}; }`;J+=`${this._terminalSelector} .${N}${w.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(V.background).css}; }${this._terminalSelector} .${N}${w.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(V.background),.5).css}; }${this._terminalSelector} .${j}${w.INVERTED_DEFAULT_COLOR} { background-color: ${V.foreground.css}; }`,this._themeStyleElement.textContent=J}_setDefaultSpacing(){const V=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${V}px`,this._rowFactory.defaultSpacing=V}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(V,J){for(let ee=this._rowElements.length;ee<=J;ee++){const W=this._document.createElement("div");this._rowContainer.appendChild(W),this._rowElements.push(W)}for(;this._rowElements.length>J;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(V,J){this._refreshRowElements(V,J),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(V,J,ee){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(V,J,ee),this.renderRows(0,this._bufferService.rows-1),!V||!J)return;this._selectionRenderModel.update(this._terminal,V,J,ee);const W=this._selectionRenderModel.viewportStartRow,Q=this._selectionRenderModel.viewportEndRow,ie=this._selectionRenderModel.viewportCappedStartRow,I=this._selectionRenderModel.viewportCappedEndRow;if(ie>=this._bufferService.rows||I<0)return;const P=this._document.createDocumentFragment();if(ee){const D=V[0]>J[0];P.appendChild(this._createSelectionElement(ie,D?J[0]:V[0],D?V[0]:J[0],I-ie+1))}else{const D=W===ie?V[0]:0,H=ie===Q?J[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(ie,D,H));const U=I-ie-1;if(P.appendChild(this._createSelectionElement(ie+1,0,this._bufferService.cols,U)),ie!==I){const L=Q===I?J[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(I,0,L))}}this._selectionContainer.appendChild(P)}_createSelectionElement(V,J,ee,W=1){const Q=this._document.createElement("div"),ie=J*this.dimensions.css.cell.width;let I=this.dimensions.css.cell.width*(ee-J);return ie+I>this.dimensions.css.canvas.width&&(I=this.dimensions.css.canvas.width-ie),Q.style.height=W*this.dimensions.css.cell.height+"px",Q.style.top=V*this.dimensions.css.cell.height+"px",Q.style.left=`${ie}px`,Q.style.width=`${I}px`,Q}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const V of this._rowElements)V.replaceChildren()}renderRows(V,J){const ee=this._bufferService.buffer,W=ee.ybase+ee.y,Q=Math.min(ee.x,this._bufferService.cols-1),ie=this._optionsService.rawOptions.cursorBlink,I=this._optionsService.rawOptions.cursorStyle,P=this._optionsService.rawOptions.cursorInactiveStyle;for(let D=V;D<=J;D++){const H=D+ee.ydisp,U=this._rowElements[D],L=ee.lines.get(H);if(!U||!L)break;U.replaceChildren(...this._rowFactory.createRow(L,H,H===W,I,P,Q,ie,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${A}${this._terminalClass}`}_handleLinkHover(V){this._setCellUnderline(V.x1,V.x2,V.y1,V.y2,V.cols,!0)}_handleLinkLeave(V){this._setCellUnderline(V.x1,V.x2,V.y1,V.y2,V.cols,!1)}_setCellUnderline(V,J,ee,W,Q,ie){ee<0&&(V=0),W<0&&(J=0);const I=this._bufferService.rows-1;ee=Math.max(Math.min(ee,I),0),W=Math.max(Math.min(W,I),0),Q=Math.min(Q,this._bufferService.cols);const P=this._bufferService.buffer,D=P.ybase+P.y,H=Math.min(P.x,Q-1),U=this._optionsService.rawOptions.cursorBlink,L=this._optionsService.rawOptions.cursorStyle,G=this._optionsService.rawOptions.cursorInactiveStyle;for(let se=ee;se<=W;++se){const Y=se+P.ydisp,F=this._rowElements[se],le=P.lines.get(Y);if(!F||!le)break;F.replaceChildren(...this._rowFactory.createRow(le,Y,Y===D,L,G,H,U,this.dimensions.css.cell.width,this._widthCache,ie?se===ee?V:0:-1,ie?(se===W?J:Q)-1:-1))}}};l.DomRenderer=q=m([y(7,k.IInstantiationService),y(8,g.ICharSizeService),y(9,k.IOptionsService),y(10,k.IBufferService),y(11,g.ICoreBrowserService),y(12,g.IThemeService)],q)},3787:function(f,l,d){var m=this&&this.__decorate||function(C,N,j,M){var O,B=arguments.length,q=B<3?N:M===null?M=Object.getOwnPropertyDescriptor(N,j):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(C,N,j,M);else for(var V=C.length-1;V>=0;V--)(O=C[V])&&(q=(B<3?O(q):B>3?O(N,j,q):O(N,j))||q);return B>3&&q&&Object.defineProperty(N,j,q),q},y=this&&this.__param||function(C,N){return function(j,M){N(j,M,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const v=d(2223),S=d(643),w=d(511),R=d(2585),x=d(8055),g=d(4725),b=d(4269),p=d(6171),_=d(3734);let k=l.DomRendererRowFactory=class{constructor(C,N,j,M,O,B,q){this._document=C,this._characterJoinerService=N,this._optionsService=j,this._coreBrowserService=M,this._coreService=O,this._decorationService=B,this._themeService=q,this._workCell=new w.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(C,N,j){this._selectionStart=C,this._selectionEnd=N,this._columnSelectMode=j}createRow(C,N,j,M,O,B,q,V,J,ee,W){const Q=[],ie=this._characterJoinerService.getJoinedCharacters(N),I=this._themeService.colors;let P,D=C.getNoBgTrimmedLength();j&&D<B+1&&(D=B+1);let H=0,U="",L=0,G=0,se=0,Y=!1,F=0,le=!1,ae=0;const X=[],te=ee!==-1&&W!==-1;for(let ue=0;ue<D;ue++){C.loadCell(ue,this._workCell);let me=this._workCell.getWidth();if(me===0)continue;let je=!1,Oe=ue,Le=this._workCell;if(ie.length>0&&ue===ie[0][0]){je=!0;const pt=ie.shift();Le=new b.JoinedCellData(this._workCell,C.translateToString(!0,pt[0],pt[1]),pt[1]-pt[0]),Oe=pt[1]-1,me=Le.getWidth()}const at=this._isCellInSelection(ue,N),Ee=j&&ue===B,qe=te&&ue>=ee&&ue<=W;let We=!1;this._decorationService.forEachDecorationAtCell(ue,N,void 0,(pt=>{We=!0}));let it=Le.getChars()||S.WHITESPACE_CELL_CHAR;if(it===" "&&(Le.isUnderline()||Le.isOverline())&&(it=" "),ae=me*V-J.get(it,Le.isBold(),Le.isItalic()),P){if(H&&(at&&le||!at&&!le&&Le.bg===L)&&(at&&le&&I.selectionForeground||Le.fg===G)&&Le.extended.ext===se&&qe===Y&&ae===F&&!Ee&&!je&&!We){Le.isInvisible()?U+=S.WHITESPACE_CELL_CHAR:U+=it,H++;continue}H&&(P.textContent=U),P=this._document.createElement("span"),H=0,U=""}else P=this._document.createElement("span");if(L=Le.bg,G=Le.fg,se=Le.extended.ext,Y=qe,F=ae,le=at,je&&B>=ue&&B<=Oe&&(B=ue),!this._coreService.isCursorHidden&&Ee&&this._coreService.isCursorInitialized){if(X.push("xterm-cursor"),this._coreBrowserService.isFocused)q&&X.push("xterm-cursor-blink"),X.push(M==="bar"?"xterm-cursor-bar":M==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(O)switch(O){case"outline":X.push("xterm-cursor-outline");break;case"block":X.push("xterm-cursor-block");break;case"bar":X.push("xterm-cursor-bar");break;case"underline":X.push("xterm-cursor-underline")}}if(Le.isBold()&&X.push("xterm-bold"),Le.isItalic()&&X.push("xterm-italic"),Le.isDim()&&X.push("xterm-dim"),U=Le.isInvisible()?S.WHITESPACE_CELL_CHAR:Le.getChars()||S.WHITESPACE_CELL_CHAR,Le.isUnderline()&&(X.push(`xterm-underline-${Le.extended.underlineStyle}`),U===" "&&(U=" "),!Le.isUnderlineColorDefault()))if(Le.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${_.AttributeData.toColorRGB(Le.getUnderlineColor()).join(",")})`;else{let pt=Le.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Le.isBold()&&pt<8&&(pt+=8),P.style.textDecorationColor=I.ansi[pt].css}Le.isOverline()&&(X.push("xterm-overline"),U===" "&&(U=" ")),Le.isStrikethrough()&&X.push("xterm-strikethrough"),qe&&(P.style.textDecoration="underline");let Ze=Le.getFgColor(),Je=Le.getFgColorMode(),wt=Le.getBgColor(),mt=Le.getBgColorMode();const Qt=!!Le.isInverse();if(Qt){const pt=Ze;Ze=wt,wt=pt;const xs=Je;Je=mt,mt=xs}let Mt,At,hs,Ft=!1;switch(this._decorationService.forEachDecorationAtCell(ue,N,void 0,(pt=>{pt.options.layer!=="top"&&Ft||(pt.backgroundColorRGB&&(mt=50331648,wt=pt.backgroundColorRGB.rgba>>8&16777215,Mt=pt.backgroundColorRGB),pt.foregroundColorRGB&&(Je=50331648,Ze=pt.foregroundColorRGB.rgba>>8&16777215,At=pt.foregroundColorRGB),Ft=pt.options.layer==="top")})),!Ft&&at&&(Mt=this._coreBrowserService.isFocused?I.selectionBackgroundOpaque:I.selectionInactiveBackgroundOpaque,wt=Mt.rgba>>8&16777215,mt=50331648,Ft=!0,I.selectionForeground&&(Je=50331648,Ze=I.selectionForeground.rgba>>8&16777215,At=I.selectionForeground)),Ft&&X.push("xterm-decoration-top"),mt){case 16777216:case 33554432:hs=I.ansi[wt],X.push(`xterm-bg-${wt}`);break;case 50331648:hs=x.channels.toColor(wt>>16,wt>>8&255,255&wt),this._addStyle(P,`background-color:#${A((wt>>>0).toString(16),"0",6)}`);break;default:Qt?(hs=I.foreground,X.push(`xterm-bg-${v.INVERTED_DEFAULT_COLOR}`)):hs=I.background}switch(Mt||Le.isDim()&&(Mt=x.color.multiplyOpacity(hs,.5)),Je){case 16777216:case 33554432:Le.isBold()&&Ze<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ze+=8),this._applyMinimumContrast(P,hs,I.ansi[Ze],Le,Mt,void 0)||X.push(`xterm-fg-${Ze}`);break;case 50331648:const pt=x.channels.toColor(Ze>>16&255,Ze>>8&255,255&Ze);this._applyMinimumContrast(P,hs,pt,Le,Mt,At)||this._addStyle(P,`color:#${A(Ze.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,hs,I.foreground,Le,Mt,At)||Qt&&X.push(`xterm-fg-${v.INVERTED_DEFAULT_COLOR}`)}X.length&&(P.className=X.join(" "),X.length=0),Ee||je||We?P.textContent=U:H++,ae!==this.defaultSpacing&&(P.style.letterSpacing=`${ae}px`),Q.push(P),ue=Oe}return P&&H&&(P.textContent=U),Q}_applyMinimumContrast(C,N,j,M,O,B){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,p.treatGlyphAsBackgroundColor)(M.getCode()))return!1;const q=this._getContrastCache(M);let V;if(O||B||(V=q.getColor(N.rgba,j.rgba)),V===void 0){const J=this._optionsService.rawOptions.minimumContrastRatio/(M.isDim()?2:1);V=x.color.ensureContrastRatio(O||N,B||j,J),q.setColor((O||N).rgba,(B||j).rgba,V??null)}return!!V&&(this._addStyle(C,`color:${V.css}`),!0)}_getContrastCache(C){return C.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(C,N){C.setAttribute("style",`${C.getAttribute("style")||""}${N};`)}_isCellInSelection(C,N){const j=this._selectionStart,M=this._selectionEnd;return!(!j||!M)&&(this._columnSelectMode?j[0]<=M[0]?C>=j[0]&&N>=j[1]&&C<M[0]&&N<=M[1]:C<j[0]&&N>=j[1]&&C>=M[0]&&N<=M[1]:N>j[1]&&N<M[1]||j[1]===M[1]&&N===j[1]&&C>=j[0]&&C<M[0]||j[1]<M[1]&&N===M[1]&&C<M[0]||j[1]<M[1]&&N===j[1]&&C>=j[0])}};function A(C,N,j){for(;C.length<j;)C=N+C;return C}l.DomRendererRowFactory=k=m([y(1,g.ICharacterJoinerService),y(2,R.IOptionsService),y(3,g.ICoreBrowserService),y(4,R.ICoreService),y(5,R.IDecorationService),y(6,g.IThemeService)],k)},2550:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.WidthCache=class{constructor(d,m){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=d.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 y=d.createElement("span");y.classList.add("xterm-char-measure-element");const v=d.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold";const S=d.createElement("span");S.classList.add("xterm-char-measure-element"),S.style.fontStyle="italic";const w=d.createElement("span");w.classList.add("xterm-char-measure-element"),w.style.fontWeight="bold",w.style.fontStyle="italic",this._measureElements=[y,v,S,w],this._container.appendChild(y),this._container.appendChild(v),this._container.appendChild(S),this._container.appendChild(w),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(d,m,y,v){d===this._font&&m===this._fontSize&&y===this._weight&&v===this._weightBold||(this._font=d,this._fontSize=m,this._weight=y,this._weightBold=v,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${y}`,this._measureElements[1].style.fontWeight=`${v}`,this._measureElements[2].style.fontWeight=`${y}`,this._measureElements[3].style.fontWeight=`${v}`,this.clear())}get(d,m,y){let v=0;if(!m&&!y&&d.length===1&&(v=d.charCodeAt(0))<256){if(this._flat[v]!==-9999)return this._flat[v];const R=this._measure(d,0);return R>0&&(this._flat[v]=R),R}let S=d;m&&(S+="B"),y&&(S+="I");let w=this._holey.get(S);if(w===void 0){let R=0;m&&(R|=1),y&&(R|=2),w=this._measure(d,R),w>0&&this._holey.set(S,w)}return w}_measure(d,m){const y=this._measureElements[m];return y.textContent=d.repeat(32),y.offsetWidth/32}}},2223:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const m=d(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=m.isFirefox||m.isLegacyEdge?"bottom":"ideographic"},6171:(f,l)=>{function d(y){return 57508<=y&&y<=57558}function m(y){return y>=128512&&y<=128591||y>=127744&&y<=128511||y>=128640&&y<=128767||y>=9728&&y<=9983||y>=9984&&y<=10175||y>=65024&&y<=65039||y>=129280&&y<=129535||y>=127462&&y<=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(y){if(!y)throw new Error("value must not be falsy");return y},l.isPowerlineGlyph=d,l.isRestrictedPowerlineGlyph=function(y){return 57520<=y&&y<=57527},l.isEmoji=m,l.allowRescaling=function(y,v,S,w){return v===1&&S>Math.ceil(1.5*w)&&y!==void 0&&y>255&&!m(y)&&!d(y)&&!(function(R){return 57344<=R&&R<=63743})(y)},l.treatGlyphAsBackgroundColor=function(y){return d(y)||(function(v){return 9472<=v&&v<=9631})(y)},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(y,v,S=0){return(y-(2*Math.round(v)-S))%(2*Math.round(v))}},6052:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createSelectionRenderModel=void 0;class d{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(y,v,S,w=!1){if(this.selectionStart=v,this.selectionEnd=S,!v||!S||v[0]===S[0]&&v[1]===S[1])return void this.clear();const R=y.buffers.active.ydisp,x=v[1]-R,g=S[1]-R,b=Math.max(x,0),p=Math.min(g,y.rows-1);b>=y.rows||p<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=w,this.viewportStartRow=x,this.viewportEndRow=g,this.viewportCappedStartRow=b,this.viewportCappedEndRow=p,this.startCol=v[0],this.endCol=S[0])}isCellSelected(y,v,S){return!!this.hasSelection&&(S-=y.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?v>=this.startCol&&S>=this.viewportCappedStartRow&&v<this.endCol&&S<=this.viewportCappedEndRow:v<this.startCol&&S>=this.viewportCappedStartRow&&v>=this.endCol&&S<=this.viewportCappedEndRow:S>this.viewportStartRow&&S<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&S===this.viewportStartRow&&v>=this.startCol&&v<this.endCol||this.viewportStartRow<this.viewportEndRow&&S===this.viewportEndRow&&v<this.endCol||this.viewportStartRow<this.viewportEndRow&&S===this.viewportStartRow&&v>=this.startCol)}}l.createSelectionRenderModel=function(){return new d}},456:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.SelectionModel=class{constructor(d){this._bufferService=d,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 d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?d%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)-1]:[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[d,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[Math.max(d,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const d=this.selectionStart,m=this.selectionEnd;return!(!d||!m)&&(d[1]>m[1]||d[1]===m[1]&&d[0]>m[0])}handleTrim(d){return this.selectionStart&&(this.selectionStart[1]-=d),this.selectionEnd&&(this.selectionEnd[1]-=d),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(f,l,d){var m=this&&this.__decorate||function(p,_,k,A){var C,N=arguments.length,j=N<3?_:A===null?A=Object.getOwnPropertyDescriptor(_,k):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(p,_,k,A);else for(var M=p.length-1;M>=0;M--)(C=p[M])&&(j=(N<3?C(j):N>3?C(_,k,j):C(_,k))||j);return N>3&&j&&Object.defineProperty(_,k,j),j},y=this&&this.__param||function(p,_){return function(k,A){_(k,A,p)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const v=d(2585),S=d(8460),w=d(844);let R=l.CharSizeService=class extends w.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(p,_,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 g(p,_,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const p=this._measureStrategy.measure();p.width===this.width&&p.height===this.height||(this.width=p.width,this.height=p.height,this._onCharSizeChange.fire())}};l.CharSizeService=R=m([y(2,v.IOptionsService)],R);class x extends w.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 g extends x{constructor(_,k,A){super(),this._document=_,this._parentElement=k,this._optionsService=A,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 x{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(f,l,d){var m=this&&this.__decorate||function(b,p,_,k){var A,C=arguments.length,N=C<3?p:k===null?k=Object.getOwnPropertyDescriptor(p,_):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,p,_,k);else for(var j=b.length-1;j>=0;j--)(A=b[j])&&(N=(C<3?A(N):C>3?A(p,_,N):A(p,_))||N);return C>3&&N&&Object.defineProperty(p,_,N),N},y=this&&this.__param||function(b,p){return function(_,k){p(_,k,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const v=d(3734),S=d(643),w=d(511),R=d(2585);class x extends v.AttributeData{constructor(p,_,k){super(),this.content=0,this.combinedData="",this.fg=p.fg,this.bg=p.bg,this.combinedData=_,this._width=k}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(p){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=x;let g=l.CharacterJoinerService=class j2{constructor(p){this._bufferService=p,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new w.CellData}register(p){const _={id:this._nextCharacterJoinerId++,handler:p};return this._characterJoiners.push(_),_.id}deregister(p){for(let _=0;_<this._characterJoiners.length;_++)if(this._characterJoiners[_].id===p)return this._characterJoiners.splice(_,1),!0;return!1}getJoinedCharacters(p){if(this._characterJoiners.length===0)return[];const _=this._bufferService.buffer.lines.get(p);if(!_||_.length===0)return[];const k=[],A=_.translateToString(!0);let C=0,N=0,j=0,M=_.getFg(0),O=_.getBg(0);for(let B=0;B<_.getTrimmedLength();B++)if(_.loadCell(B,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==M||this._workCell.bg!==O){if(B-C>1){const q=this._getJoinedRanges(A,j,N,_,C);for(let V=0;V<q.length;V++)k.push(q[V])}C=B,j=N,M=this._workCell.fg,O=this._workCell.bg}N+=this._workCell.getChars().length||S.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-C>1){const B=this._getJoinedRanges(A,j,N,_,C);for(let q=0;q<B.length;q++)k.push(B[q])}return k}_getJoinedRanges(p,_,k,A,C){const N=p.substring(_,k);let j=[];try{j=this._characterJoiners[0].handler(N)}catch(M){console.error(M)}for(let M=1;M<this._characterJoiners.length;M++)try{const O=this._characterJoiners[M].handler(N);for(let B=0;B<O.length;B++)j2._mergeRanges(j,O[B])}catch(O){console.error(O)}return this._stringRangesToCellRanges(j,A,C),j}_stringRangesToCellRanges(p,_,k){let A=0,C=!1,N=0,j=p[A];if(j){for(let M=k;M<this._bufferService.cols;M++){const O=_.getWidth(M),B=_.getString(M).length||S.WHITESPACE_CELL_CHAR.length;if(O!==0){if(!C&&j[0]<=N&&(j[0]=M,C=!0),j[1]<=N){if(j[1]=M,j=p[++A],!j)break;j[0]<=N?(j[0]=M,C=!0):C=!1}N+=B}}j&&(j[1]=this._bufferService.cols)}}static _mergeRanges(p,_){let k=!1;for(let A=0;A<p.length;A++){const C=p[A];if(k){if(_[1]<=C[0])return p[A-1][1]=_[1],p;if(_[1]<=C[1])return p[A-1][1]=Math.max(_[1],C[1]),p.splice(A,1),p;p.splice(A,1),A--}else{if(_[1]<=C[0])return p.splice(A,0,_),p;if(_[1]<=C[1])return C[0]=Math.min(_[0],C[0]),p;_[0]<C[1]&&(C[0]=Math.min(_[0],C[0]),k=!0)}}return k?p[p.length-1][1]=_[1]:p.push(_),p}};l.CharacterJoinerService=g=m([y(0,R.IBufferService)],g)},5114:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0;const m=d(844),y=d(8460),v=d(3656);class S extends m.Disposable{constructor(x,g,b){super(),this._textarea=x,this._window=g,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new w(this._window),this._onDprChange=this.register(new y.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new y.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((p=>this._screenDprMonitor.setWindow(p)))),this.register((0,y.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(x){this._window!==x&&(this._window=x,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 w extends m.Disposable{constructor(x){super(),this._parentWindow=x,this._windowResizeListener=this.register(new m.MutableDisposable),this._onDprChange=this.register(new y.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(x){this._parentWindow=x,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,v.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var x;this._outerListener&&((x=this._resolutionMediaMatchList)==null||x.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:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkProviderService=void 0;const m=d(844);class y 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 w=this.linkProviders.indexOf(S);w!==-1&&this.linkProviders.splice(w,1)}}}}l.LinkProviderService=y},8934:function(f,l,d){var m=this&&this.__decorate||function(R,x,g,b){var p,_=arguments.length,k=_<3?x:b===null?b=Object.getOwnPropertyDescriptor(x,g):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(R,x,g,b);else for(var A=R.length-1;A>=0;A--)(p=R[A])&&(k=(_<3?p(k):_>3?p(x,g,k):p(x,g))||k);return _>3&&k&&Object.defineProperty(x,g,k),k},y=this&&this.__param||function(R,x){return function(g,b){x(g,b,R)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const v=d(4725),S=d(9806);let w=l.MouseService=class{constructor(R,x){this._renderService=R,this._charSizeService=x}getCoords(R,x,g,b,p){return(0,S.getCoords)(window,R,x,g,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,p)}getMouseReportCoords(R,x){const g=(0,S.getCoordsRelativeToElement)(window,R,x);if(this._charSizeService.hasValidSize)return g[0]=Math.min(Math.max(g[0],0),this._renderService.dimensions.css.canvas.width-1),g[1]=Math.min(Math.max(g[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(g[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(g[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(g[0]),y:Math.floor(g[1])}}};l.MouseService=w=m([y(0,v.IRenderService),y(1,v.ICharSizeService)],w)},3230:function(f,l,d){var m=this&&this.__decorate||function(p,_,k,A){var C,N=arguments.length,j=N<3?_:A===null?A=Object.getOwnPropertyDescriptor(_,k):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(p,_,k,A);else for(var M=p.length-1;M>=0;M--)(C=p[M])&&(j=(N<3?C(j):N>3?C(_,k,j):C(_,k))||j);return N>3&&j&&Object.defineProperty(_,k,j),j},y=this&&this.__param||function(p,_){return function(k,A){_(k,A,p)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const v=d(6193),S=d(4725),w=d(8460),R=d(844),x=d(7226),g=d(2585);let b=l.RenderService=class extends R.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(p,_,k,A,C,N,j,M){super(),this._rowCount=p,this._charSizeService=A,this._renderer=this.register(new R.MutableDisposable),this._pausedResizeTask=new x.DebouncedIdleTask,this._observerDisposable=this.register(new R.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 w.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new w.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new w.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new v.RenderDebouncer(((O,B)=>this._renderRows(O,B)),j),this.register(this._renderDebouncer),this.register(j.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(N.onResize((()=>this._fullRefresh()))),this.register(N.buffers.onBufferActivate((()=>{var O;return(O=this._renderer.value)==null?void 0:O.clear()}))),this.register(k.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(C.onDecorationRegistered((()=>this._fullRefresh()))),this.register(C.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(N.cols,N.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(N.buffer.y,N.buffer.y,!0)))),this.register(M.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(j.window,_),this.register(j.onWindowChange((O=>this._registerIntersectionObserver(O,_))))}_registerIntersectionObserver(p,_){if("IntersectionObserver"in p){const k=new p.IntersectionObserver((A=>this._handleIntersectionChange(A[A.length-1])),{threshold:0});k.observe(_),this._observerDisposable.value=(0,R.toDisposable)((()=>k.disconnect()))}}_handleIntersectionChange(p){this._isPaused=p.isIntersecting===void 0?p.intersectionRatio===0:!p.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(p,_,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(p,_,this._rowCount))}_renderRows(p,_){this._renderer.value&&(p=Math.min(p,this._rowCount-1),_=Math.min(_,this._rowCount-1),this._renderer.value.renderRows(p,_),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:p,end:_}),this._onRender.fire({start:p,end:_}),this._isNextRenderRedrawOnly=!0)}resize(p,_){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(p){this._renderer.value=p,this._renderer.value&&(this._renderer.value.onRequestRedraw((_=>this.refreshRows(_.start,_.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(p){return this._renderDebouncer.addRefreshCallback(p)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var p,_;this._renderer.value&&((_=(p=this._renderer.value).clearTextureAtlas)==null||_.call(p),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(p,_){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var k;return(k=this._renderer.value)==null?void 0:k.handleResize(p,_)})):this._renderer.value.handleResize(p,_),this._fullRefresh())}handleCharSizeChanged(){var p;(p=this._renderer.value)==null||p.handleCharSizeChanged()}handleBlur(){var p;(p=this._renderer.value)==null||p.handleBlur()}handleFocus(){var p;(p=this._renderer.value)==null||p.handleFocus()}handleSelectionChanged(p,_,k){var A;this._selectionState.start=p,this._selectionState.end=_,this._selectionState.columnSelectMode=k,(A=this._renderer.value)==null||A.handleSelectionChanged(p,_,k)}handleCursorMove(){var p;(p=this._renderer.value)==null||p.handleCursorMove()}clear(){var p;(p=this._renderer.value)==null||p.clear()}};l.RenderService=b=m([y(2,g.IOptionsService),y(3,S.ICharSizeService),y(4,g.IDecorationService),y(5,g.IBufferService),y(6,S.ICoreBrowserService),y(7,S.IThemeService)],b)},9312:function(f,l,d){var m=this&&this.__decorate||function(j,M,O,B){var q,V=arguments.length,J=V<3?M:B===null?B=Object.getOwnPropertyDescriptor(M,O):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")J=Reflect.decorate(j,M,O,B);else for(var ee=j.length-1;ee>=0;ee--)(q=j[ee])&&(J=(V<3?q(J):V>3?q(M,O,J):q(M,O))||J);return V>3&&J&&Object.defineProperty(M,O,J),J},y=this&&this.__param||function(j,M){return function(O,B){M(O,B,j)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const v=d(9806),S=d(9504),w=d(456),R=d(4725),x=d(8460),g=d(844),b=d(6114),p=d(4841),_=d(511),k=d(2585),A=" ",C=new RegExp(A,"g");let N=l.SelectionService=class extends g.Disposable{constructor(j,M,O,B,q,V,J,ee,W){super(),this._element=j,this._screenElement=M,this._linkifier=O,this._bufferService=B,this._coreService=q,this._mouseService=V,this._optionsService=J,this._renderService=ee,this._coreBrowserService=W,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 x.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new x.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new x.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new x.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=Q=>this._handleMouseMove(Q),this._mouseUpListener=Q=>this._handleMouseUp(Q),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((Q=>this._handleTrim(Q))),this.register(this._bufferService.buffers.onBufferActivate((Q=>this._handleBufferActivate(Q)))),this.enable(),this._model=new w.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,g.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 O=this._bufferService.buffer,B=[];if(this._activeSelectionMode===3){if(j[0]===M[0])return"";const q=j[0]<M[0]?j[0]:M[0],V=j[0]<M[0]?M[0]:j[0];for(let J=j[1];J<=M[1];J++){const ee=O.translateBufferLineToString(J,!0,q,V);B.push(ee)}}else{const q=j[1]===M[1]?M[0]:void 0;B.push(O.translateBufferLineToString(j[1],!0,j[0],q));for(let V=j[1]+1;V<=M[1]-1;V++){const J=O.lines.get(V),ee=O.translateBufferLineToString(V,!0);J!=null&&J.isWrapped?B[B.length-1]+=ee:B.push(ee)}if(j[1]!==M[1]){const V=O.lines.get(M[1]),J=O.translateBufferLineToString(M[1],!0,0,M[0]);V&&V.isWrapped?B[B.length-1]+=J:B.push(J)}}return B.map((q=>q.replace(C," "))).join(b.isWindows?`\r
483
+ `:`
484
+ `)}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),O=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!!(O&&B&&M)&&this._areCoordsInSelection(M,O,B)}isCellInSelection(j,M){const O=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!O||!B)&&this._areCoordsInSelection([j,M],O,B)}_areCoordsInSelection(j,M,O){return j[1]>M[1]&&j[1]<O[1]||M[1]===O[1]&&j[1]===M[1]&&j[0]>=M[0]&&j[0]<O[0]||M[1]<O[1]&&j[1]===O[1]&&j[0]<O[0]||M[1]<O[1]&&j[1]===M[1]&&j[0]>=M[0]}_selectWordAtCursor(j,M){var q,V;const O=(V=(q=this._linkifier.currentLink)==null?void 0:q.link)==null?void 0:V.range;if(O)return this._model.selectionStart=[O.start.x-1,O.start.y-1],this._model.selectionStartLength=(0,p.getRangeLength)(O,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const B=this._getMouseBufferCoords(j);return!!B&&(this._selectWordAt(B,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,v.getCoordsRelativeToElement)(this._coreBrowserService.window,j,this._screenElement)[1];const O=this._renderService.dimensions.css.canvas.height;return M>=0&&M<=O?0:(M>O&&(M-=O),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 O=this._bufferService.buffer;if(this._model.selectionEnd[1]<O.lines.length){const B=O.lines.get(this._model.selectionEnd[1]);B&&B.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 O=this._mouseService.getCoords(j,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(O&&O[0]!==void 0&&O[1]!==void 0){const B=(0,S.moveToCellSequence)(O[0]-1,O[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const j=this._model.finalSelectionStart,M=this._model.finalSelectionEnd,O=!(!j||!M||j[0]===M[0]&&j[1]===M[1]);O?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,O)):this._oldHasSelection&&this._fireOnSelectionChange(j,M,O)}_fireOnSelectionChange(j,M,O){this._oldSelectionStart=j,this._oldSelectionEnd=M,this._oldHasSelection=O,this._onSelectionChange.fire()}_handleBufferActivate(j){this.clearSelection(),this._trimListener.dispose(),this._trimListener=j.activeBuffer.lines.onTrim((M=>this._handleTrim(M)))}_convertViewportColToCharacterIndex(j,M){let O=M;for(let B=0;M>=B;B++){const q=j.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?O--:q>1&&M!==B&&(O+=q-1)}return O}setSelection(j,M,O){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[j,M],this._model.selectionStartLength=O,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(j){this._isClickInSelection(j)||(this._selectWordAtCursor(j,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(j,M,O=!0,B=!0){if(j[0]>=this._bufferService.cols)return;const q=this._bufferService.buffer,V=q.lines.get(j[1]);if(!V)return;const J=q.translateBufferLineToString(j[1],!1);let ee=this._convertViewportColToCharacterIndex(V,j[0]),W=ee;const Q=j[0]-ee;let ie=0,I=0,P=0,D=0;if(J.charAt(ee)===" "){for(;ee>0&&J.charAt(ee-1)===" ";)ee--;for(;W<J.length&&J.charAt(W+1)===" ";)W++}else{let L=j[0],G=j[0];V.getWidth(L)===0&&(ie++,L--),V.getWidth(G)===2&&(I++,G++);const se=V.getString(G).length;for(se>1&&(D+=se-1,W+=se-1);L>0&&ee>0&&!this._isCharWordSeparator(V.loadCell(L-1,this._workCell));){V.loadCell(L-1,this._workCell);const Y=this._workCell.getChars().length;this._workCell.getWidth()===0?(ie++,L--):Y>1&&(P+=Y-1,ee-=Y-1),ee--,L--}for(;G<V.length&&W+1<J.length&&!this._isCharWordSeparator(V.loadCell(G+1,this._workCell));){V.loadCell(G+1,this._workCell);const Y=this._workCell.getChars().length;this._workCell.getWidth()===2?(I++,G++):Y>1&&(D+=Y-1,W+=Y-1),W++,G++}}W++;let H=ee+Q-ie+P,U=Math.min(this._bufferService.cols,W-ee+ie+I-P-D);if(M||J.slice(ee,W).trim()!==""){if(O&&H===0&&V.getCodePoint(0)!==32){const L=q.lines.get(j[1]-1);if(L&&V.isWrapped&&L.getCodePoint(this._bufferService.cols-1)!==32){const G=this._getWordAt([this._bufferService.cols-1,j[1]-1],!1,!0,!1);if(G){const se=this._bufferService.cols-G.start;H-=se,U+=se}}}if(B&&H+U===this._bufferService.cols&&V.getCodePoint(this._bufferService.cols-1)!==32){const L=q.lines.get(j[1]+1);if(L!=null&&L.isWrapped&&L.getCodePoint(0)!==32){const G=this._getWordAt([0,j[1]+1],!1,!1,!0);G&&(U+=G.length)}}return{start:H,length:U}}}_selectWordAt(j,M){const O=this._getWordAt(j,M);if(O){for(;O.start<0;)O.start+=this._bufferService.cols,j[1]--;this._model.selectionStart=[O.start,j[1]],this._model.selectionStartLength=O.length}}_selectToWordAt(j){const M=this._getWordAt(j,!0);if(M){let O=j[1];for(;M.start<0;)M.start+=this._bufferService.cols,O--;if(!this._model.areSelectionValuesReversed())for(;M.start+M.length>this._bufferService.cols;)M.length-=this._bufferService.cols,O++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?M.start:M.start+M.length,O]}}_isCharWordSeparator(j){return j.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(j.getChars())>=0}_selectLineAt(j){const M=this._bufferService.buffer.getWrappedRangeForLine(j),O={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,p.getRangeLength)(O,this._bufferService.cols)}};l.SelectionService=N=m([y(3,k.IBufferService),y(4,k.ICoreService),y(5,R.IMouseService),y(6,k.IOptionsService),y(7,R.IRenderService),y(8,R.ICoreBrowserService)],N)},4725:(f,l,d)=>{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=d(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(f,l,d){var m=this&&this.__decorate||function(N,j,M,O){var B,q=arguments.length,V=q<3?j:O===null?O=Object.getOwnPropertyDescriptor(j,M):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")V=Reflect.decorate(N,j,M,O);else for(var J=N.length-1;J>=0;J--)(B=N[J])&&(V=(q<3?B(V):q>3?B(j,M,V):B(j,M))||V);return q>3&&V&&Object.defineProperty(j,M,V),V},y=this&&this.__param||function(N,j){return function(M,O){j(M,O,N)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const v=d(7239),S=d(8055),w=d(8460),R=d(844),x=d(2585),g=S.css.toColor("#ffffff"),b=S.css.toColor("#000000"),p=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 N=[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 O=j[M/36%6|0],B=j[M/6%6|0],q=j[M%6];N.push({css:S.channels.toCss(O,B,q),rgba:S.channels.toRgba(O,B,q)})}for(let M=0;M<24;M++){const O=8+10*M;N.push({css:S.channels.toCss(O,O,O),rgba:S.channels.toRgba(O,O,O)})}return N})());let A=l.ThemeService=class extends R.Disposable{get colors(){return this._colors}constructor(N){super(),this._optionsService=N,this._contrastCache=new v.ColorContrastCache,this._halfContrastCache=new v.ColorContrastCache,this._onChangeColors=this.register(new w.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:g,background:b,cursor:p,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(N={}){const j=this._colors;if(j.foreground=C(N.foreground,g),j.background=C(N.background,b),j.cursor=C(N.cursor,p),j.cursorAccent=C(N.cursorAccent,_),j.selectionBackgroundTransparent=C(N.selectionBackground,k),j.selectionBackgroundOpaque=S.color.blend(j.background,j.selectionBackgroundTransparent),j.selectionInactiveBackgroundTransparent=C(N.selectionInactiveBackground,j.selectionBackgroundTransparent),j.selectionInactiveBackgroundOpaque=S.color.blend(j.background,j.selectionInactiveBackgroundTransparent),j.selectionForeground=N.selectionForeground?C(N.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]=C(N.black,l.DEFAULT_ANSI_COLORS[0]),j.ansi[1]=C(N.red,l.DEFAULT_ANSI_COLORS[1]),j.ansi[2]=C(N.green,l.DEFAULT_ANSI_COLORS[2]),j.ansi[3]=C(N.yellow,l.DEFAULT_ANSI_COLORS[3]),j.ansi[4]=C(N.blue,l.DEFAULT_ANSI_COLORS[4]),j.ansi[5]=C(N.magenta,l.DEFAULT_ANSI_COLORS[5]),j.ansi[6]=C(N.cyan,l.DEFAULT_ANSI_COLORS[6]),j.ansi[7]=C(N.white,l.DEFAULT_ANSI_COLORS[7]),j.ansi[8]=C(N.brightBlack,l.DEFAULT_ANSI_COLORS[8]),j.ansi[9]=C(N.brightRed,l.DEFAULT_ANSI_COLORS[9]),j.ansi[10]=C(N.brightGreen,l.DEFAULT_ANSI_COLORS[10]),j.ansi[11]=C(N.brightYellow,l.DEFAULT_ANSI_COLORS[11]),j.ansi[12]=C(N.brightBlue,l.DEFAULT_ANSI_COLORS[12]),j.ansi[13]=C(N.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),j.ansi[14]=C(N.brightCyan,l.DEFAULT_ANSI_COLORS[14]),j.ansi[15]=C(N.brightWhite,l.DEFAULT_ANSI_COLORS[15]),N.extendedAnsi){const M=Math.min(j.ansi.length-16,N.extendedAnsi.length);for(let O=0;O<M;O++)j.ansi[O+16]=C(N.extendedAnsi[O],l.DEFAULT_ANSI_COLORS[O+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(N){this._restoreColor(N),this._onChangeColors.fire(this.colors)}_restoreColor(N){if(N!==void 0)switch(N){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[N]=this._restoreColors.ansi[N]}else for(let j=0;j<this._restoreColors.ansi.length;++j)this._colors.ansi[j]=this._restoreColors.ansi[j]}modifyColors(N){N(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 C(N,j){if(N!==void 0)try{return S.css.toColor(N)}catch{}return j}l.ThemeService=A=m([y(0,x.IOptionsService)],A)},6349:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CircularList=void 0;const m=d(8460),y=d(844);class v extends y.Disposable{constructor(w){super(),this._maxLength=w,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(w){if(this._maxLength===w)return;const R=new Array(w);for(let x=0;x<Math.min(w,this.length);x++)R[x]=this._array[this._getCyclicIndex(x)];this._array=R,this._maxLength=w,this._startIndex=0}get length(){return this._length}set length(w){if(w>this._length)for(let R=this._length;R<w;R++)this._array[R]=void 0;this._length=w}get(w){return this._array[this._getCyclicIndex(w)]}set(w,R){this._array[this._getCyclicIndex(w)]=R}push(w){this._array[this._getCyclicIndex(this._length)]=w,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(w,R,...x){if(R){for(let g=w;g<this._length-R;g++)this._array[this._getCyclicIndex(g)]=this._array[this._getCyclicIndex(g+R)];this._length-=R,this.onDeleteEmitter.fire({index:w,amount:R})}for(let g=this._length-1;g>=w;g--)this._array[this._getCyclicIndex(g+x.length)]=this._array[this._getCyclicIndex(g)];for(let g=0;g<x.length;g++)this._array[this._getCyclicIndex(w+g)]=x[g];if(x.length&&this.onInsertEmitter.fire({index:w,amount:x.length}),this._length+x.length>this._maxLength){const g=this._length+x.length-this._maxLength;this._startIndex+=g,this._length=this._maxLength,this.onTrimEmitter.fire(g)}else this._length+=x.length}trimStart(w){w>this._length&&(w=this._length),this._startIndex+=w,this._length-=w,this.onTrimEmitter.fire(w)}shiftElements(w,R,x){if(!(R<=0)){if(w<0||w>=this._length)throw new Error("start argument out of range");if(w+x<0)throw new Error("Cannot shift elements in list beyond index 0");if(x>0){for(let b=R-1;b>=0;b--)this.set(w+b+x,this.get(w+b));const g=w+R+x-this._length;if(g>0)for(this._length+=g;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let g=0;g<R;g++)this.set(w+g+x,this.get(w+g))}}_getCyclicIndex(w){return(this._startIndex+w)%this._maxLength}}l.CircularList=v},1439:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.clone=void 0,l.clone=function d(m,y=5){if(typeof m!="object")return m;const v=Array.isArray(m)?[]:{};for(const S in m)v[S]=y<=1?m[S]:m[S]&&d(m[S],y-1);return v}},8055:(f,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 d=0,m=0,y=0,v=0;var S,w,R,x,g;function b(_){const k=_.toString(16);return k.length<2?"0"+k:k}function p(_,k){return _<k?(k+.05)/(_+.05):(_+.05)/(k+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},(function(_){_.toCss=function(k,A,C,N){return N!==void 0?`#${b(k)}${b(A)}${b(C)}${b(N)}`:`#${b(k)}${b(A)}${b(C)}`},_.toRgba=function(k,A,C,N=255){return(k<<24|A<<16|C<<8|N)>>>0},_.toColor=function(k,A,C,N){return{css:_.toCss(k,A,C,N),rgba:_.toRgba(k,A,C,N)}}})(S||(l.channels=S={})),(function(_){function k(A,C){return v=Math.round(255*C),[d,m,y]=g.toChannels(A.rgba),{css:S.toCss(d,m,y,v),rgba:S.toRgba(d,m,y,v)}}_.blend=function(A,C){if(v=(255&C.rgba)/255,v===1)return{css:C.css,rgba:C.rgba};const N=C.rgba>>24&255,j=C.rgba>>16&255,M=C.rgba>>8&255,O=A.rgba>>24&255,B=A.rgba>>16&255,q=A.rgba>>8&255;return d=O+Math.round((N-O)*v),m=B+Math.round((j-B)*v),y=q+Math.round((M-q)*v),{css:S.toCss(d,m,y),rgba:S.toRgba(d,m,y)}},_.isOpaque=function(A){return(255&A.rgba)==255},_.ensureContrastRatio=function(A,C,N){const j=g.ensureContrastRatio(A.rgba,C.rgba,N);if(j)return S.toColor(j>>24&255,j>>16&255,j>>8&255)},_.opaque=function(A){const C=(255|A.rgba)>>>0;return[d,m,y]=g.toChannels(C),{css:S.toCss(d,m,y),rgba:C}},_.opacity=k,_.multiplyOpacity=function(A,C){return v=255&A.rgba,k(A,v*C/255)},_.toColorRGB=function(A){return[A.rgba>>24&255,A.rgba>>16&255,A.rgba>>8&255]}})(w||(l.color=w={})),(function(_){let k,A;try{const C=document.createElement("canvas");C.width=1,C.height=1;const N=C.getContext("2d",{willReadFrequently:!0});N&&(k=N,k.globalCompositeOperation="copy",A=k.createLinearGradient(0,0,1,1))}catch{}_.toColor=function(C){if(C.match(/#[\da-f]{3,8}/i))switch(C.length){case 4:return d=parseInt(C.slice(1,2).repeat(2),16),m=parseInt(C.slice(2,3).repeat(2),16),y=parseInt(C.slice(3,4).repeat(2),16),S.toColor(d,m,y);case 5:return d=parseInt(C.slice(1,2).repeat(2),16),m=parseInt(C.slice(2,3).repeat(2),16),y=parseInt(C.slice(3,4).repeat(2),16),v=parseInt(C.slice(4,5).repeat(2),16),S.toColor(d,m,y,v);case 7:return{css:C,rgba:(parseInt(C.slice(1),16)<<8|255)>>>0};case 9:return{css:C,rgba:parseInt(C.slice(1),16)>>>0}}const N=C.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(N)return d=parseInt(N[1]),m=parseInt(N[2]),y=parseInt(N[3]),v=Math.round(255*(N[5]===void 0?1:parseFloat(N[5]))),S.toColor(d,m,y,v);if(!k||!A)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=A,k.fillStyle=C,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[d,m,y,v]=k.getImageData(0,0,1,1).data,v!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:S.toRgba(d,m,y,v),css:C}}})(R||(l.css=R={})),(function(_){function k(A,C,N){const j=A/255,M=C/255,O=N/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*(O<=.03928?O/12.92:Math.pow((O+.055)/1.055,2.4))}_.relativeLuminance=function(A){return k(A>>16&255,A>>8&255,255&A)},_.relativeLuminance2=k})(x||(l.rgb=x={})),(function(_){function k(C,N,j){const M=C>>24&255,O=C>>16&255,B=C>>8&255;let q=N>>24&255,V=N>>16&255,J=N>>8&255,ee=p(x.relativeLuminance2(q,V,J),x.relativeLuminance2(M,O,B));for(;ee<j&&(q>0||V>0||J>0);)q-=Math.max(0,Math.ceil(.1*q)),V-=Math.max(0,Math.ceil(.1*V)),J-=Math.max(0,Math.ceil(.1*J)),ee=p(x.relativeLuminance2(q,V,J),x.relativeLuminance2(M,O,B));return(q<<24|V<<16|J<<8|255)>>>0}function A(C,N,j){const M=C>>24&255,O=C>>16&255,B=C>>8&255;let q=N>>24&255,V=N>>16&255,J=N>>8&255,ee=p(x.relativeLuminance2(q,V,J),x.relativeLuminance2(M,O,B));for(;ee<j&&(q<255||V<255||J<255);)q=Math.min(255,q+Math.ceil(.1*(255-q))),V=Math.min(255,V+Math.ceil(.1*(255-V))),J=Math.min(255,J+Math.ceil(.1*(255-J))),ee=p(x.relativeLuminance2(q,V,J),x.relativeLuminance2(M,O,B));return(q<<24|V<<16|J<<8|255)>>>0}_.blend=function(C,N){if(v=(255&N)/255,v===1)return N;const j=N>>24&255,M=N>>16&255,O=N>>8&255,B=C>>24&255,q=C>>16&255,V=C>>8&255;return d=B+Math.round((j-B)*v),m=q+Math.round((M-q)*v),y=V+Math.round((O-V)*v),S.toRgba(d,m,y)},_.ensureContrastRatio=function(C,N,j){const M=x.relativeLuminance(C>>8),O=x.relativeLuminance(N>>8);if(p(M,O)<j){if(O<M){const V=k(C,N,j),J=p(M,x.relativeLuminance(V>>8));if(J<j){const ee=A(C,N,j);return J>p(M,x.relativeLuminance(ee>>8))?V:ee}return V}const B=A(C,N,j),q=p(M,x.relativeLuminance(B>>8));if(q<j){const V=k(C,N,j);return q>p(M,x.relativeLuminance(V>>8))?B:V}return B}},_.reduceLuminance=k,_.increaseLuminance=A,_.toChannels=function(C){return[C>>24&255,C>>16&255,C>>8&255,255&C]}})(g||(l.rgba=g={})),l.toPaddedHex=b,l.contrastRatio=p},8969:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const m=d(844),y=d(2585),v=d(4348),S=d(7866),w=d(744),R=d(7302),x=d(6975),g=d(8460),b=d(1753),p=d(1480),_=d(7994),k=d(9282),A=d(5435),C=d(5981),N=d(2660);let j=!1;class M extends m.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new g.EventEmitter),this._onScroll.event((B=>{var q;(q=this._onScrollApi)==null||q.fire(B.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(B){for(const q in B)this.optionsService.options[q]=B[q]}constructor(B){super(),this._windowsWrappingHeuristics=this.register(new m.MutableDisposable),this._onBinary=this.register(new g.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new g.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new g.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new g.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new g.EventEmitter),this._instantiationService=new v.InstantiationService,this.optionsService=this.register(new R.OptionsService(B)),this._instantiationService.setService(y.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(w.BufferService)),this._instantiationService.setService(y.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(S.LogService)),this._instantiationService.setService(y.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(x.CoreService)),this._instantiationService.setService(y.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(b.CoreMouseService)),this._instantiationService.setService(y.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(p.UnicodeService)),this._instantiationService.setService(y.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(_.CharsetService),this._instantiationService.setService(y.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(N.OscLinkService),this._instantiationService.setService(y.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new A.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,g.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,g.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,g.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,g.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 C.WriteBuffer(((q,V)=>this._inputHandler.parse(q,V)))),this.register((0,g.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(B,q){this._writeBuffer.write(B,q)}writeSync(B,q){this._logService.logLevel<=y.LogLevelEnum.WARN&&!j&&(this._logService.warn("writeSync is unreliable and will be removed soon."),j=!0),this._writeBuffer.writeSync(B,q)}input(B,q=!0){this.coreService.triggerDataEvent(B,q)}resize(B,q){isNaN(B)||isNaN(q)||(B=Math.max(B,w.MINIMUM_COLS),q=Math.max(q,w.MINIMUM_ROWS),this._bufferService.resize(B,q))}scroll(B,q=!1){this._bufferService.scroll(B,q)}scrollLines(B,q,V){this._bufferService.scrollLines(B,q,V)}scrollPages(B){this.scrollLines(B*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(B){const q=B-this._bufferService.buffer.ydisp;q!==0&&this.scrollLines(q)}registerEscHandler(B,q){return this._inputHandler.registerEscHandler(B,q)}registerDcsHandler(B,q){return this._inputHandler.registerDcsHandler(B,q)}registerCsiHandler(B,q){return this._inputHandler.registerCsiHandler(B,q)}registerOscHandler(B,q){return this._inputHandler.registerOscHandler(B,q)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let B=!1;const q=this.optionsService.rawOptions.windowsPty;q&&q.buildNumber!==void 0&&q.buildNumber!==void 0?B=q.backend==="conpty"&&q.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(B=!0),B?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const B=[];B.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.registerCsiHandler({final:"H"},(()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,m.toDisposable)((()=>{for(const q of B)q.dispose()}))}}}l.CoreTerminal=M},8460:(f,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=d=>(this._listeners.push(d),{dispose:()=>{if(!this._disposed){for(let m=0;m<this._listeners.length;m++)if(this._listeners[m]===d)return void this._listeners.splice(m,1)}}})),this._event}fire(d,m){const y=[];for(let v=0;v<this._listeners.length;v++)y.push(this._listeners[v]);for(let v=0;v<y.length;v++)y[v].call(void 0,d,m)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(d,m){return d((y=>m.fire(y)))},l.runAndSubscribe=function(d,m){return m(void 0),d((y=>m(y)))}},5435:function(f,l,d){var m=this&&this.__decorate||function(ie,I,P,D){var H,U=arguments.length,L=U<3?I:D===null?D=Object.getOwnPropertyDescriptor(I,P):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(ie,I,P,D);else for(var G=ie.length-1;G>=0;G--)(H=ie[G])&&(L=(U<3?H(L):U>3?H(I,P,L):H(I,P))||L);return U>3&&L&&Object.defineProperty(I,P,L),L},y=this&&this.__param||function(ie,I){return function(P,D){I(P,D,ie)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const v=d(2584),S=d(7116),w=d(2015),R=d(844),x=d(482),g=d(8437),b=d(8460),p=d(643),_=d(511),k=d(3734),A=d(2585),C=d(1480),N=d(6242),j=d(6351),M=d(5941),O={"(":0,")":1,"*":2,"+":3,"-":1,".":2},B=131072;function q(ie,I){if(ie>24)return I.setWinLines||!1;switch(ie){case 1:return!!I.restoreWin;case 2:return!!I.minimizeWin;case 3:return!!I.setWinPosition;case 4:return!!I.setWinSizePixels;case 5:return!!I.raiseWin;case 6:return!!I.lowerWin;case 7:return!!I.refreshWin;case 8:return!!I.setWinSizeChars;case 9:return!!I.maximizeWin;case 10:return!!I.fullscreenWin;case 11:return!!I.getWinState;case 13:return!!I.getWinPosition;case 14:return!!I.getWinSizePixels;case 15:return!!I.getScreenSizePixels;case 16:return!!I.getCellSizePixels;case 18:return!!I.getWinSizeChars;case 19:return!!I.getScreenSizeChars;case 20:return!!I.getIconTitle;case 21:return!!I.getWinTitle;case 22:return!!I.pushTitle;case 23:return!!I.popTitle;case 24:return!!I.setWinLines}return!1}var V;(function(ie){ie[ie.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",ie[ie.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(V||(l.WindowsOptionsReportType=V={}));let J=0;class ee extends R.Disposable{getAttrData(){return this._curAttrData}constructor(I,P,D,H,U,L,G,se,Y=new w.EscapeSequenceParser){super(),this._bufferService=I,this._charsetService=P,this._coreService=D,this._logService=H,this._optionsService=U,this._oscLinkService=L,this._coreMouseService=G,this._unicodeService=se,this._parser=Y,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new x.StringToUtf32,this._utf8Decoder=new x.Utf8ToUtf32,this._workCell=new _.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=g.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=g.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 W(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((F=>this._activeBuffer=F.activeBuffer))),this._parser.setCsiHandlerFallback(((F,le)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(F),params:le.toArray()})})),this._parser.setEscHandlerFallback((F=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(F)})})),this._parser.setExecuteHandlerFallback((F=>{this._logService.debug("Unknown EXECUTE code: ",{code:F})})),this._parser.setOscHandlerFallback(((F,le,ae)=>{this._logService.debug("Unknown OSC code: ",{identifier:F,action:le,data:ae})})),this._parser.setDcsHandlerFallback(((F,le,ae)=>{le==="HOOK"&&(ae=ae.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(F),action:le,payload:ae})})),this._parser.setPrintHandler(((F,le,ae)=>this.print(F,le,ae))),this._parser.registerCsiHandler({final:"@"},(F=>this.insertChars(F))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(F=>this.scrollLeft(F))),this._parser.registerCsiHandler({final:"A"},(F=>this.cursorUp(F))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(F=>this.scrollRight(F))),this._parser.registerCsiHandler({final:"B"},(F=>this.cursorDown(F))),this._parser.registerCsiHandler({final:"C"},(F=>this.cursorForward(F))),this._parser.registerCsiHandler({final:"D"},(F=>this.cursorBackward(F))),this._parser.registerCsiHandler({final:"E"},(F=>this.cursorNextLine(F))),this._parser.registerCsiHandler({final:"F"},(F=>this.cursorPrecedingLine(F))),this._parser.registerCsiHandler({final:"G"},(F=>this.cursorCharAbsolute(F))),this._parser.registerCsiHandler({final:"H"},(F=>this.cursorPosition(F))),this._parser.registerCsiHandler({final:"I"},(F=>this.cursorForwardTab(F))),this._parser.registerCsiHandler({final:"J"},(F=>this.eraseInDisplay(F,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(F=>this.eraseInDisplay(F,!0))),this._parser.registerCsiHandler({final:"K"},(F=>this.eraseInLine(F,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(F=>this.eraseInLine(F,!0))),this._parser.registerCsiHandler({final:"L"},(F=>this.insertLines(F))),this._parser.registerCsiHandler({final:"M"},(F=>this.deleteLines(F))),this._parser.registerCsiHandler({final:"P"},(F=>this.deleteChars(F))),this._parser.registerCsiHandler({final:"S"},(F=>this.scrollUp(F))),this._parser.registerCsiHandler({final:"T"},(F=>this.scrollDown(F))),this._parser.registerCsiHandler({final:"X"},(F=>this.eraseChars(F))),this._parser.registerCsiHandler({final:"Z"},(F=>this.cursorBackwardTab(F))),this._parser.registerCsiHandler({final:"`"},(F=>this.charPosAbsolute(F))),this._parser.registerCsiHandler({final:"a"},(F=>this.hPositionRelative(F))),this._parser.registerCsiHandler({final:"b"},(F=>this.repeatPrecedingCharacter(F))),this._parser.registerCsiHandler({final:"c"},(F=>this.sendDeviceAttributesPrimary(F))),this._parser.registerCsiHandler({prefix:">",final:"c"},(F=>this.sendDeviceAttributesSecondary(F))),this._parser.registerCsiHandler({final:"d"},(F=>this.linePosAbsolute(F))),this._parser.registerCsiHandler({final:"e"},(F=>this.vPositionRelative(F))),this._parser.registerCsiHandler({final:"f"},(F=>this.hVPosition(F))),this._parser.registerCsiHandler({final:"g"},(F=>this.tabClear(F))),this._parser.registerCsiHandler({final:"h"},(F=>this.setMode(F))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(F=>this.setModePrivate(F))),this._parser.registerCsiHandler({final:"l"},(F=>this.resetMode(F))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(F=>this.resetModePrivate(F))),this._parser.registerCsiHandler({final:"m"},(F=>this.charAttributes(F))),this._parser.registerCsiHandler({final:"n"},(F=>this.deviceStatus(F))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(F=>this.deviceStatusPrivate(F))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(F=>this.softReset(F))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(F=>this.setCursorStyle(F))),this._parser.registerCsiHandler({final:"r"},(F=>this.setScrollRegion(F))),this._parser.registerCsiHandler({final:"s"},(F=>this.saveCursor(F))),this._parser.registerCsiHandler({final:"t"},(F=>this.windowOptions(F))),this._parser.registerCsiHandler({final:"u"},(F=>this.restoreCursor(F))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(F=>this.insertColumns(F))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(F=>this.deleteColumns(F))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(F=>this.selectProtected(F))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(F=>this.requestMode(F,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(F=>this.requestMode(F,!1))),this._parser.setExecuteHandler(v.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(v.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(v.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(v.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(v.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(v.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(v.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(v.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(v.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(v.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(v.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(v.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new N.OscHandler((F=>(this.setTitle(F),this.setIconName(F),!0)))),this._parser.registerOscHandler(1,new N.OscHandler((F=>this.setIconName(F)))),this._parser.registerOscHandler(2,new N.OscHandler((F=>this.setTitle(F)))),this._parser.registerOscHandler(4,new N.OscHandler((F=>this.setOrReportIndexedColor(F)))),this._parser.registerOscHandler(8,new N.OscHandler((F=>this.setHyperlink(F)))),this._parser.registerOscHandler(10,new N.OscHandler((F=>this.setOrReportFgColor(F)))),this._parser.registerOscHandler(11,new N.OscHandler((F=>this.setOrReportBgColor(F)))),this._parser.registerOscHandler(12,new N.OscHandler((F=>this.setOrReportCursorColor(F)))),this._parser.registerOscHandler(104,new N.OscHandler((F=>this.restoreIndexedColor(F)))),this._parser.registerOscHandler(110,new N.OscHandler((F=>this.restoreFgColor(F)))),this._parser.registerOscHandler(111,new N.OscHandler((F=>this.restoreBgColor(F)))),this._parser.registerOscHandler(112,new N.OscHandler((F=>this.restoreCursorColor(F)))),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 F in S.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:F},(()=>this.selectCharset("("+F))),this._parser.registerEscHandler({intermediates:")",final:F},(()=>this.selectCharset(")"+F))),this._parser.registerEscHandler({intermediates:"*",final:F},(()=>this.selectCharset("*"+F))),this._parser.registerEscHandler({intermediates:"+",final:F},(()=>this.selectCharset("+"+F))),this._parser.registerEscHandler({intermediates:"-",final:F},(()=>this.selectCharset("-"+F))),this._parser.registerEscHandler({intermediates:".",final:F},(()=>this.selectCharset("."+F))),this._parser.registerEscHandler({intermediates:"/",final:F},(()=>this.selectCharset("/"+F)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((F=>(this._logService.error("Parsing error: ",F),F))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new j.DcsHandler(((F,le)=>this.requestStatusString(F,le))))}_preserveStack(I,P,D,H){this._parseStack.paused=!0,this._parseStack.cursorStartX=I,this._parseStack.cursorStartY=P,this._parseStack.decodedLength=D,this._parseStack.position=H}_logSlowResolvingAsync(I){this._logService.logLevel<=A.LogLevelEnum.WARN&&Promise.race([I,new Promise(((P,D)=>setTimeout((()=>D("#SLOW_TIMEOUT")),5e3)))]).catch((P=>{if(P!=="#SLOW_TIMEOUT")throw P;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(I,P){let D,H=this._activeBuffer.x,U=this._activeBuffer.y,L=0;const G=this._parseStack.paused;if(G){if(D=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,P))return this._logSlowResolvingAsync(D),D;H=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,I.length>B&&(L=this._parseStack.position+B)}if(this._logService.logLevel<=A.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof I=="string"?` "${I}"`:` "${Array.prototype.map.call(I,(F=>String.fromCharCode(F))).join("")}"`),typeof I=="string"?I.split("").map((F=>F.charCodeAt(0))):I),this._parseBuffer.length<I.length&&this._parseBuffer.length<B&&(this._parseBuffer=new Uint32Array(Math.min(I.length,B))),G||this._dirtyRowTracker.clearRange(),I.length>B)for(let F=L;F<I.length;F+=B){const le=F+B<I.length?F+B:I.length,ae=typeof I=="string"?this._stringDecoder.decode(I.substring(F,le),this._parseBuffer):this._utf8Decoder.decode(I.subarray(F,le),this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,ae))return this._preserveStack(H,U,ae,F),this._logSlowResolvingAsync(D),D}else if(!G){const F=typeof I=="string"?this._stringDecoder.decode(I,this._parseBuffer):this._utf8Decoder.decode(I,this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,F))return this._preserveStack(H,U,F,0),this._logSlowResolvingAsync(D),D}this._activeBuffer.x===H&&this._activeBuffer.y===U||this._onCursorMove.fire();const se=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),Y=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);Y<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(Y,this._bufferService.rows-1),Math.min(se,this._bufferService.rows-1))}print(I,P,D){let H,U;const L=this._charsetService.charset,G=this._optionsService.rawOptions.screenReaderMode,se=this._bufferService.cols,Y=this._coreService.decPrivateModes.wraparound,F=this._coreService.modes.insertMode,le=this._curAttrData;let ae=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&D-P>0&&ae.getWidth(this._activeBuffer.x-1)===2&&ae.setCellFromCodepoint(this._activeBuffer.x-1,0,1,le);let X=this._parser.precedingJoinState;for(let te=P;te<D;++te){if(H=I[te],H<127&&L){const Oe=L[String.fromCharCode(H)];Oe&&(H=Oe.charCodeAt(0))}const ue=this._unicodeService.charProperties(H,X);U=C.UnicodeService.extractWidth(ue);const me=C.UnicodeService.extractShouldJoin(ue),je=me?C.UnicodeService.extractWidth(X):0;if(X=ue,G&&this._onA11yChar.fire((0,x.stringFromCodePoint)(H)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-je>se){if(Y){const Oe=ae;let Le=this._activeBuffer.x-je;for(this._activeBuffer.x=je,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),ae=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),je>0&&ae instanceof g.BufferLine&&ae.copyCellsFrom(Oe,Le,0,je,!1);Le<se;)Oe.setCellFromCodepoint(Le++,0,1,le)}else if(this._activeBuffer.x=se-1,U===2)continue}if(me&&this._activeBuffer.x){const Oe=ae.getWidth(this._activeBuffer.x-1)?1:2;ae.addCodepointToCell(this._activeBuffer.x-Oe,H,U);for(let Le=U-je;--Le>=0;)ae.setCellFromCodepoint(this._activeBuffer.x++,0,0,le)}else if(F&&(ae.insertCells(this._activeBuffer.x,U-je,this._activeBuffer.getNullCell(le)),ae.getWidth(se-1)===2&&ae.setCellFromCodepoint(se-1,p.NULL_CELL_CODE,p.NULL_CELL_WIDTH,le)),ae.setCellFromCodepoint(this._activeBuffer.x++,H,U,le),U>0)for(;--U;)ae.setCellFromCodepoint(this._activeBuffer.x++,0,0,le)}this._parser.precedingJoinState=X,this._activeBuffer.x<se&&D-P>0&&ae.getWidth(this._activeBuffer.x)===0&&!ae.hasContent(this._activeBuffer.x)&&ae.setCellFromCodepoint(this._activeBuffer.x,0,1,le),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(I,P){return I.final!=="t"||I.prefix||I.intermediates?this._parser.registerCsiHandler(I,P):this._parser.registerCsiHandler(I,(D=>!q(D.params[0],this._optionsService.rawOptions.windowOptions)||P(D)))}registerDcsHandler(I,P){return this._parser.registerDcsHandler(I,new j.DcsHandler(P))}registerEscHandler(I,P){return this._parser.registerEscHandler(I,P)}registerOscHandler(I,P){return this._parser.registerOscHandler(I,new N.OscHandler(P))}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 I;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&&((I=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&I.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);P.hasWidth(this._activeBuffer.x)&&!P.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const I=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-I),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(I=this._bufferService.cols-1){this._activeBuffer.x=Math.min(I,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(I,P){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=I,this._activeBuffer.y=this._activeBuffer.scrollTop+P):(this._activeBuffer.x=I,this._activeBuffer.y=P),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(I,P){this._restrictCursor(),this._setCursor(this._activeBuffer.x+I,this._activeBuffer.y+P)}cursorUp(I){const P=this._activeBuffer.y-this._activeBuffer.scrollTop;return P>=0?this._moveCursor(0,-Math.min(P,I.params[0]||1)):this._moveCursor(0,-(I.params[0]||1)),!0}cursorDown(I){const P=this._activeBuffer.scrollBottom-this._activeBuffer.y;return P>=0?this._moveCursor(0,Math.min(P,I.params[0]||1)):this._moveCursor(0,I.params[0]||1),!0}cursorForward(I){return this._moveCursor(I.params[0]||1,0),!0}cursorBackward(I){return this._moveCursor(-(I.params[0]||1),0),!0}cursorNextLine(I){return this.cursorDown(I),this._activeBuffer.x=0,!0}cursorPrecedingLine(I){return this.cursorUp(I),this._activeBuffer.x=0,!0}cursorCharAbsolute(I){return this._setCursor((I.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(I){return this._setCursor(I.length>=2?(I.params[1]||1)-1:0,(I.params[0]||1)-1),!0}charPosAbsolute(I){return this._setCursor((I.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(I){return this._moveCursor(I.params[0]||1,0),!0}linePosAbsolute(I){return this._setCursor(this._activeBuffer.x,(I.params[0]||1)-1),!0}vPositionRelative(I){return this._moveCursor(0,I.params[0]||1),!0}hVPosition(I){return this.cursorPosition(I),!0}tabClear(I){const P=I.params[0];return P===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:P===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(I){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=I.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(I){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=I.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(I){const P=I.params[0];return P===1&&(this._curAttrData.bg|=536870912),P!==2&&P!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(I,P,D,H=!1,U=!1){const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);L.replaceCells(P,D,this._activeBuffer.getNullCell(this._eraseAttrData()),U),H&&(L.isWrapped=!1)}_resetBufferLine(I,P=!1){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);D&&(D.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),P),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+I),D.isWrapped=!1)}eraseInDisplay(I,P=!1){let D;switch(this._restrictCursor(this._bufferService.cols),I.params[0]){case 0:for(D=this._activeBuffer.y,this._dirtyRowTracker.markDirty(D),this._eraseInBufferLine(D++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);D<this._bufferService.rows;D++)this._resetBufferLine(D,P);this._dirtyRowTracker.markDirty(D);break;case 1:for(D=this._activeBuffer.y,this._dirtyRowTracker.markDirty(D),this._eraseInBufferLine(D,0,this._activeBuffer.x+1,!0,P),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(D+1).isWrapped=!1);D--;)this._resetBufferLine(D,P);this._dirtyRowTracker.markDirty(0);break;case 2:for(D=this._bufferService.rows,this._dirtyRowTracker.markDirty(D-1);D--;)this._resetBufferLine(D,P);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(I,P=!1){switch(this._restrictCursor(this._bufferService.cols),I.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,P);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,P)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(I){this._restrictCursor();let P=I.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=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(;P--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(D,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(I){this._restrictCursor();let P=I.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=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;P--;)this._activeBuffer.lines.splice(D,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(I){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.insertCells(this._activeBuffer.x,I.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(I){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.deleteCells(this._activeBuffer.x,I.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(I){let P=I.params[0]||1;for(;P--;)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(I){let P=I.params[0]||1;for(;P--;)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(g.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(I){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=I.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);H.deleteCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(I){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=I.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);H.insertCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(I){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=I.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);H.insertCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(I){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=I.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);H.deleteCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),H.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(I){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(I.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(I){const P=this._parser.precedingJoinState;if(!P)return!0;const D=I.params[0]||1,H=C.UnicodeService.extractWidth(P),U=this._activeBuffer.x-H,L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),G=new Uint32Array(L.length*D);let se=0;for(let F=0;F<L.length;){const le=L.codePointAt(F)||0;G[se++]=le,F+=le>65535?2:1}let Y=se;for(let F=1;F<D;++F)G.copyWithin(Y,0,se),Y+=se;return this.print(G,0,Y),!0}sendDeviceAttributesPrimary(I){return I.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(v.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(v.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(I){return I.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(v.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(v.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(I.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(v.C0.ESC+"[>83;40003;0c")),!0}_is(I){return(this._optionsService.rawOptions.termName+"").indexOf(I)===0}setMode(I){for(let P=0;P<I.length;P++)switch(I.params[P]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(I){for(let P=0;P<I.length;P++)switch(I.params[P]){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(I){for(let P=0;P<I.length;P++)switch(I.params[P]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(I){for(let P=0;P<I.length;P++)switch(I.params[P]){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(),I.params[P]===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(I,P){const D=this._coreService.decPrivateModes,{activeProtocol:H,activeEncoding:U}=this._coreMouseService,L=this._coreService,{buffers:G,cols:se}=this._bufferService,{active:Y,alt:F}=G,le=this._optionsService.rawOptions,ae=me=>me?1:2,X=I.params[0];return te=X,ue=P?X===2?4:X===4?ae(L.modes.insertMode):X===12?3:X===20?ae(le.convertEol):0:X===1?ae(D.applicationCursorKeys):X===3?le.windowOptions.setWinLines?se===80?2:se===132?1:0:0:X===6?ae(D.origin):X===7?ae(D.wraparound):X===8?3:X===9?ae(H==="X10"):X===12?ae(le.cursorBlink):X===25?ae(!L.isCursorHidden):X===45?ae(D.reverseWraparound):X===66?ae(D.applicationKeypad):X===67?4:X===1e3?ae(H==="VT200"):X===1002?ae(H==="DRAG"):X===1003?ae(H==="ANY"):X===1004?ae(D.sendFocus):X===1005?4:X===1006?ae(U==="SGR"):X===1015?4:X===1016?ae(U==="SGR_PIXELS"):X===1048?1:X===47||X===1047||X===1049?ae(Y===F):X===2004?ae(D.bracketedPasteMode):0,L.triggerDataEvent(`${v.C0.ESC}[${P?"":"?"}${te};${ue}$y`),!0;var te,ue}_updateAttrColor(I,P,D,H,U){return P===2?(I|=50331648,I&=-16777216,I|=k.AttributeData.fromColorRGB([D,H,U])):P===5&&(I&=-50331904,I|=33554432|255&D),I}_extractColor(I,P,D){const H=[0,0,-1,0,0,0];let U=0,L=0;do{if(H[L+U]=I.params[P+L],I.hasSubParams(P+L)){const G=I.getSubParams(P+L);let se=0;do H[1]===5&&(U=1),H[L+se+1+U]=G[se];while(++se<G.length&&se+L+1+U<H.length);break}if(H[1]===5&&L+U>=2||H[1]===2&&L+U>=5)break;H[1]&&(U=1)}while(++L+P<I.length&&L+U<H.length);for(let G=2;G<H.length;++G)H[G]===-1&&(H[G]=0);switch(H[0]){case 38:D.fg=this._updateAttrColor(D.fg,H[1],H[3],H[4],H[5]);break;case 48:D.bg=this._updateAttrColor(D.bg,H[1],H[3],H[4],H[5]);break;case 58:D.extended=D.extended.clone(),D.extended.underlineColor=this._updateAttrColor(D.extended.underlineColor,H[1],H[3],H[4],H[5])}return L}_processUnderline(I,P){P.extended=P.extended.clone(),(!~I||I>5)&&(I=1),P.extended.underlineStyle=I,P.fg|=268435456,I===0&&(P.fg&=-268435457),P.updateExtended()}_processSGR0(I){I.fg=g.DEFAULT_ATTR_DATA.fg,I.bg=g.DEFAULT_ATTR_DATA.bg,I.extended=I.extended.clone(),I.extended.underlineStyle=0,I.extended.underlineColor&=-67108864,I.updateExtended()}charAttributes(I){if(I.length===1&&I.params[0]===0)return this._processSGR0(this._curAttrData),!0;const P=I.length;let D;const H=this._curAttrData;for(let U=0;U<P;U++)D=I.params[U],D>=30&&D<=37?(H.fg&=-50331904,H.fg|=16777216|D-30):D>=40&&D<=47?(H.bg&=-50331904,H.bg|=16777216|D-40):D>=90&&D<=97?(H.fg&=-50331904,H.fg|=16777224|D-90):D>=100&&D<=107?(H.bg&=-50331904,H.bg|=16777224|D-100):D===0?this._processSGR0(H):D===1?H.fg|=134217728:D===3?H.bg|=67108864:D===4?(H.fg|=268435456,this._processUnderline(I.hasSubParams(U)?I.getSubParams(U)[0]:1,H)):D===5?H.fg|=536870912:D===7?H.fg|=67108864:D===8?H.fg|=1073741824:D===9?H.fg|=2147483648:D===2?H.bg|=134217728:D===21?this._processUnderline(2,H):D===22?(H.fg&=-134217729,H.bg&=-134217729):D===23?H.bg&=-67108865:D===24?(H.fg&=-268435457,this._processUnderline(0,H)):D===25?H.fg&=-536870913:D===27?H.fg&=-67108865:D===28?H.fg&=-1073741825:D===29?H.fg&=2147483647:D===39?(H.fg&=-67108864,H.fg|=16777215&g.DEFAULT_ATTR_DATA.fg):D===49?(H.bg&=-67108864,H.bg|=16777215&g.DEFAULT_ATTR_DATA.bg):D===38||D===48||D===58?U+=this._extractColor(I,U,H):D===53?H.bg|=1073741824:D===55?H.bg&=-1073741825:D===59?(H.extended=H.extended.clone(),H.extended.underlineColor=-1,H.updateExtended()):D===100?(H.fg&=-67108864,H.fg|=16777215&g.DEFAULT_ATTR_DATA.fg,H.bg&=-67108864,H.bg|=16777215&g.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",D);return!0}deviceStatus(I){switch(I.params[0]){case 5:this._coreService.triggerDataEvent(`${v.C0.ESC}[0n`);break;case 6:const P=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${v.C0.ESC}[${P};${D}R`)}return!0}deviceStatusPrivate(I){if(I.params[0]===6){const P=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${v.C0.ESC}[?${P};${D}R`)}return!0}softReset(I){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=g.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(I){const P=I.params[0]||1;switch(P){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 D=P%2==1;return this._optionsService.options.cursorBlink=D,!0}setScrollRegion(I){const P=I.params[0]||1;let D;return(I.length<2||(D=I.params[1])>this._bufferService.rows||D===0)&&(D=this._bufferService.rows),D>P&&(this._activeBuffer.scrollTop=P-1,this._activeBuffer.scrollBottom=D-1,this._setCursor(0,0)),!0}windowOptions(I){if(!q(I.params[0],this._optionsService.rawOptions.windowOptions))return!0;const P=I.length>1?I.params[1]:0;switch(I.params[0]){case 14:P!==2&&this._onRequestWindowsOptionsReport.fire(V.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(V.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${v.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:P!==0&&P!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),P!==0&&P!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:P!==0&&P!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),P!==0&&P!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(I){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(I){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(I){return this._windowTitle=I,this._onTitleChange.fire(I),!0}setIconName(I){return this._iconName=I,!0}setOrReportIndexedColor(I){const P=[],D=I.split(";");for(;D.length>1;){const H=D.shift(),U=D.shift();if(/^\d+$/.exec(H)){const L=parseInt(H);if(Q(L))if(U==="?")P.push({type:0,index:L});else{const G=(0,M.parseColor)(U);G&&P.push({type:1,index:L,color:G})}}}return P.length&&this._onColor.fire(P),!0}setHyperlink(I){const P=I.split(";");return!(P.length<2)&&(P[1]?this._createHyperlink(P[0],P[1]):!P[0]&&this._finishHyperlink())}_createHyperlink(I,P){this._getCurrentLinkId()&&this._finishHyperlink();const D=I.split(":");let H;const U=D.findIndex((L=>L.startsWith("id=")));return U!==-1&&(H=D[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:H,uri:P}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(I,P){const D=I.split(";");for(let H=0;H<D.length&&!(P>=this._specialColors.length);++H,++P)if(D[H]==="?")this._onColor.fire([{type:0,index:this._specialColors[P]}]);else{const U=(0,M.parseColor)(D[H]);U&&this._onColor.fire([{type:1,index:this._specialColors[P],color:U}])}return!0}setOrReportFgColor(I){return this._setOrReportSpecialColor(I,0)}setOrReportBgColor(I){return this._setOrReportSpecialColor(I,1)}setOrReportCursorColor(I){return this._setOrReportSpecialColor(I,2)}restoreIndexedColor(I){if(!I)return this._onColor.fire([{type:2}]),!0;const P=[],D=I.split(";");for(let H=0;H<D.length;++H)if(/^\d+$/.exec(D[H])){const U=parseInt(D[H]);Q(U)&&P.push({type:2,index:U})}return P.length&&this._onColor.fire(P),!0}restoreFgColor(I){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(I){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(I){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(I){return I.length!==2?(this.selectDefaultCharset(),!0):(I[0]==="/"||this._charsetService.setgCharset(O[I[0]],S.CHARSETS[I[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 I=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,I,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=g.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=g.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(I){return this._charsetService.setgLevel(I),!0}screenAlignmentPattern(){const I=new _.CellData;I.content=4194373,I.fg=this._curAttrData.fg,I.bg=this._curAttrData.bg,this._setCursor(0,0);for(let P=0;P<this._bufferService.rows;++P){const D=this._activeBuffer.ybase+this._activeBuffer.y+P,H=this._activeBuffer.lines.get(D);H&&(H.fill(I),H.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(I,P){const D=this._bufferService.buffer,H=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${v.C0.ESC}${U}${v.C0.ESC}\\`),!0))(I==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:I==='"p'?'P1$r61;1"p':I==="r"?`P1$r${D.scrollTop+1};${D.scrollBottom+1}r`:I==="m"?"P1$r0m":I===" q"?`P1$r${{block:2,underline:4,bar:6}[H.cursorStyle]-(H.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(I,P){this._dirtyRowTracker.markRangeDirty(I,P)}}l.InputHandler=ee;let W=class{constructor(ie){this._bufferService=ie,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(ie){ie<this.start?this.start=ie:ie>this.end&&(this.end=ie)}markRangeDirty(ie,I){ie>I&&(J=ie,ie=I,I=J),ie<this.start&&(this.start=ie),I>this.end&&(this.end=I)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Q(ie){return 0<=ie&&ie<256}W=m([y(0,A.IBufferService)],W)},844:(f,l)=>{function d(m){for(const y of m)y.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 y=this._disposables.indexOf(m);y!==-1&&this._disposables.splice(y,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(m){var y;this._isDisposed||m===this._value||((y=this._value)==null||y.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=d,l.getDisposeArrayDisposable=function(m){return{dispose:()=>d(m)}}},1505:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class d{constructor(){this._data={}}set(y,v,S){this._data[y]||(this._data[y]={}),this._data[y][v]=S}get(y,v){return this._data[y]?this._data[y][v]:void 0}clear(){this._data={}}}l.TwoKeyMap=d,l.FourKeyMap=class{constructor(){this._data=new d}set(m,y,v,S,w){this._data.get(m,y)||this._data.set(m,y,new d),this._data.get(m,y).set(v,S,w)}get(m,y,v,S){var w;return(w=this._data.get(m,y))==null?void 0:w.get(v,S)}clear(){this._data.clear()}}},6114:(f,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 d=l.isNode?"node":navigator.userAgent,m=l.isNode?"node":navigator.platform;l.isFirefox=d.includes("Firefox"),l.isLegacyEdge=d.includes("Edge"),l.isSafari=/^((?!chrome|android).)*safari/i.test(d),l.getSafariVersion=function(){if(!l.isSafari)return 0;const y=d.match(/Version\/(\d+)/);return y===null||y.length<2?0:parseInt(y[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(d)},6106:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SortedList=void 0;let d=0;l.SortedList=class{constructor(m){this._getKey=m,this._array=[]}clear(){this._array.length=0}insert(m){this._array.length!==0?(d=this._search(this._getKey(m)),this._array.splice(d,0,m)):this._array.push(m)}delete(m){if(this._array.length===0)return!1;const y=this._getKey(m);if(y===void 0||(d=this._search(y),d===-1)||this._getKey(this._array[d])!==y)return!1;do if(this._array[d]===m)return this._array.splice(d,1),!0;while(++d<this._array.length&&this._getKey(this._array[d])===y);return!1}*getKeyIterator(m){if(this._array.length!==0&&(d=this._search(m),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===m))do yield this._array[d];while(++d<this._array.length&&this._getKey(this._array[d])===m)}forEachByKey(m,y){if(this._array.length!==0&&(d=this._search(m),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===m))do y(this._array[d]);while(++d<this._array.length&&this._getKey(this._array[d])===m)}values(){return[...this._array].values()}_search(m){let y=0,v=this._array.length-1;for(;v>=y;){let S=y+v>>1;const w=this._getKey(this._array[S]);if(w>m)v=S-1;else{if(!(w<m)){for(;S>0&&this._getKey(this._array[S-1])===m;)S--;return S}y=S+1}}return y}}},7226:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DebouncedIdleTask=l.IdleTaskQueue=l.PriorityTaskQueue=void 0;const m=d(6114);class y{constructor(){this._tasks=[],this._i=0}enqueue(w){this._tasks.push(w),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(w){this._idleCallback=void 0;let R=0,x=0,g=w.timeRemaining(),b=0;for(;this._i<this._tasks.length;){if(R=Date.now(),this._tasks[this._i]()||this._i++,R=Math.max(1,Date.now()-R),x=Math.max(R,x),b=w.timeRemaining(),1.5*x>b)return g-R<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(g-R))}ms`),void this._start();g=b}this.clear()}}class v extends y{_requestCallback(w){return setTimeout((()=>w(this._createDeadline(16))))}_cancelCallback(w){clearTimeout(w)}_createDeadline(w){const R=Date.now()+w;return{timeRemaining:()=>Math.max(0,R-Date.now())}}}l.PriorityTaskQueue=v,l.IdleTaskQueue=!m.isNode&&"requestIdleCallback"in window?class extends y{_requestCallback(S){return requestIdleCallback(S)}_cancelCallback(S){cancelIdleCallback(S)}}:v,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(S){this._queue.clear(),this._queue.enqueue(S)}flush(){this._queue.flush()}}},9282:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.updateWindowsModeWrappedState=void 0;const m=d(643);l.updateWindowsModeWrappedState=function(y){const v=y.buffer.lines.get(y.buffer.ybase+y.buffer.y-1),S=v==null?void 0:v.get(y.cols-1),w=y.buffer.lines.get(y.buffer.ybase+y.buffer.y);w&&S&&(w.isWrapped=S[m.CHAR_DATA_CODE_INDEX]!==m.NULL_CELL_CODE&&S[m.CHAR_DATA_CODE_INDEX]!==m.WHITESPACE_CELL_CODE)}},3734:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExtendedAttrs=l.AttributeData=void 0;class d{constructor(){this.fg=0,this.bg=0,this.extended=new m}static toColorRGB(v){return[v>>>16&255,v>>>8&255,255&v]}static fromColorRGB(v){return(255&v[0])<<16|(255&v[1])<<8|255&v[2]}clone(){const v=new d;return v.fg=this.fg,v.bg=this.bg,v.extended=this.extended.clone(),v}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=d;class m{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(v){this._ext=v}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(v){this._ext&=-469762049,this._ext|=v<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(v){this._ext&=-67108864,this._ext|=67108863&v}get urlId(){return this._urlId}set urlId(v){this._urlId=v}get underlineVariantOffset(){const v=(3758096384&this._ext)>>29;return v<0?4294967288^v:v}set underlineVariantOffset(v){this._ext&=536870911,this._ext|=v<<29&3758096384}constructor(v=0,S=0){this._ext=0,this._urlId=0,this._ext=v,this._urlId=S}clone(){return new m(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}l.ExtendedAttrs=m},9092:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Buffer=l.MAX_BUFFER_SIZE=void 0;const m=d(6349),y=d(7226),v=d(3734),S=d(8437),w=d(4634),R=d(511),x=d(643),g=d(4863),b=d(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(p,_,k){this._hasScrollback=p,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=R.CellData.fromCharData([0,x.NULL_CELL_CHAR,x.NULL_CELL_WIDTH,x.NULL_CELL_CODE]),this._whitespaceCell=R.CellData.fromCharData([0,x.WHITESPACE_CELL_CHAR,x.WHITESPACE_CELL_WIDTH,x.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new y.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(p){return p?(this._nullCell.fg=p.fg,this._nullCell.bg=p.bg,this._nullCell.extended=p.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new v.ExtendedAttrs),this._nullCell}getWhitespaceCell(p){return p?(this._whitespaceCell.fg=p.fg,this._whitespaceCell.bg=p.bg,this._whitespaceCell.extended=p.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new v.ExtendedAttrs),this._whitespaceCell}getBlankLine(p,_){return new S.BufferLine(this._bufferService.cols,this.getNullCell(p),_)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const p=this.ybase+this.y-this.ydisp;return p>=0&&p<this._rows}_getCorrectBufferLength(p){if(!this._hasScrollback)return p;const _=p+this._optionsService.rawOptions.scrollback;return _>l.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:_}fillViewportRows(p){if(this.lines.length===0){p===void 0&&(p=S.DEFAULT_ATTR_DATA);let _=this._rows;for(;_--;)this.lines.push(this.getBlankLine(p))}}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(p,_){const k=this.getNullCell(S.DEFAULT_ATTR_DATA);let A=0;const C=this._getCorrectBufferLength(_);if(C>this.lines.maxLength&&(this.lines.maxLength=C),this.lines.length>0){if(this._cols<p)for(let j=0;j<this.lines.length;j++)A+=+this.lines.get(j).resize(p,k);let N=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(p,k)):this.ybase>0&&this.lines.length<=this.ybase+this.y+N+1?(this.ybase--,N++,this.ydisp>0&&this.ydisp--):this.lines.push(new S.BufferLine(p,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(C<this.lines.maxLength){const j=this.lines.length-C;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=C}this.x=Math.min(this.x,p-1),this.y=Math.min(this.y,_-1),N&&(this.y+=N),this.savedX=Math.min(this.savedX,p-1),this.scrollTop=0}if(this.scrollBottom=_-1,this._isReflowEnabled&&(this._reflow(p,_),this._cols>p))for(let N=0;N<this.lines.length;N++)A+=+this.lines.get(N).resize(p,k);this._cols=p,this._rows=_,this._memoryCleanupQueue.clear(),A>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let p=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,p=!1);let _=0;for(;this._memoryCleanupPosition<this.lines.length;)if(_+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),_>100)return!0;return p}get _isReflowEnabled(){const p=this._optionsService.rawOptions.windowsPty;return p&&p.buildNumber?this._hasScrollback&&p.backend==="conpty"&&p.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(p,_){this._cols!==p&&(p>this._cols?this._reflowLarger(p,_):this._reflowSmaller(p,_))}_reflowLarger(p,_){const k=(0,w.reflowLargerGetLinesToRemove)(this.lines,this._cols,p,this.ybase+this.y,this.getNullCell(S.DEFAULT_ATTR_DATA));if(k.length>0){const A=(0,w.reflowLargerCreateNewLayout)(this.lines,k);(0,w.reflowLargerApplyNewLayout)(this.lines,A.layout),this._reflowLargerAdjustViewport(p,_,A.countRemoved)}}_reflowLargerAdjustViewport(p,_,k){const A=this.getNullCell(S.DEFAULT_ATTR_DATA);let C=k;for(;C-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<_&&this.lines.push(new S.BufferLine(p,A))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-k,0)}_reflowSmaller(p,_){const k=this.getNullCell(S.DEFAULT_ATTR_DATA),A=[];let C=0;for(let N=this.lines.length-1;N>=0;N--){let j=this.lines.get(N);if(!j||!j.isWrapped&&j.getTrimmedLength()<=p)continue;const M=[j];for(;j.isWrapped&&N>0;)j=this.lines.get(--N),M.unshift(j);const O=this.ybase+this.y;if(O>=N&&O<N+M.length)continue;const B=M[M.length-1].getTrimmedLength(),q=(0,w.reflowSmallerGetNewLineLengths)(M,this._cols,p),V=q.length-M.length;let J;J=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+V):Math.max(0,this.lines.length-this.lines.maxLength+V);const ee=[];for(let D=0;D<V;D++){const H=this.getBlankLine(S.DEFAULT_ATTR_DATA,!0);ee.push(H)}ee.length>0&&(A.push({start:N+M.length+C,newLines:ee}),C+=ee.length),M.push(...ee);let W=q.length-1,Q=q[W];Q===0&&(W--,Q=q[W]);let ie=M.length-V-1,I=B;for(;ie>=0;){const D=Math.min(I,Q);if(M[W]===void 0)break;if(M[W].copyCellsFrom(M[ie],I-D,Q-D,D,!0),Q-=D,Q===0&&(W--,Q=q[W]),I-=D,I===0){ie--;const H=Math.max(ie,0);I=(0,w.getWrappedLineTrimmedLength)(M,H,this._cols)}}for(let D=0;D<M.length;D++)q[D]<p&&M[D].setCell(q[D],k);let P=V-J;for(;P-- >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+C)-_&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+V,this.ybase+_-1)}if(A.length>0){const N=[],j=[];for(let W=0;W<this.lines.length;W++)j.push(this.lines.get(W));const M=this.lines.length;let O=M-1,B=0,q=A[B];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+C);let V=0;for(let W=Math.min(this.lines.maxLength-1,M+C-1);W>=0;W--)if(q&&q.start>O+V){for(let Q=q.newLines.length-1;Q>=0;Q--)this.lines.set(W--,q.newLines[Q]);W++,N.push({index:O+1,amount:q.newLines.length}),V+=q.newLines.length,q=A[++B]}else this.lines.set(W,j[O--]);let J=0;for(let W=N.length-1;W>=0;W--)N[W].index+=J,this.lines.onInsertEmitter.fire(N[W]),J+=N[W].amount;const ee=Math.max(0,M+C-this.lines.maxLength);ee>0&&this.lines.onTrimEmitter.fire(ee)}}translateBufferLineToString(p,_,k=0,A){const C=this.lines.get(p);return C?C.translateToString(_,k,A):""}getWrappedRangeForLine(p){let _=p,k=p;for(;_>0&&this.lines.get(_).isWrapped;)_--;for(;k+1<this.lines.length&&this.lines.get(k+1).isWrapped;)k++;return{first:_,last:k}}setupTabStops(p){for(p!=null?this.tabs[p]||(p=this.prevStop(p)):(this.tabs={},p=0);p<this._cols;p+=this._optionsService.rawOptions.tabStopWidth)this.tabs[p]=!0}prevStop(p){for(p==null&&(p=this.x);!this.tabs[--p]&&p>0;);return p>=this._cols?this._cols-1:p<0?0:p}nextStop(p){for(p==null&&(p=this.x);!this.tabs[++p]&&p<this._cols;);return p>=this._cols?this._cols-1:p<0?0:p}clearMarkers(p){this._isClearing=!0;for(let _=0;_<this.markers.length;_++)this.markers[_].line===p&&(this.markers[_].dispose(),this.markers.splice(_--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let p=0;p<this.markers.length;p++)this.markers[p].dispose(),this.markers.splice(p--,1);this._isClearing=!1}addMarker(p){const _=new g.Marker(p);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(p){this._isClearing||this.markers.splice(this.markers.indexOf(p),1)}}},8437:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLine=l.DEFAULT_ATTR_DATA=void 0;const m=d(3734),y=d(511),v=d(643),S=d(482);l.DEFAULT_ATTR_DATA=Object.freeze(new m.AttributeData);let w=0;class R{constructor(g,b,p=!1){this.isWrapped=p,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*g);const _=b||y.CellData.fromCharData([0,v.NULL_CELL_CHAR,v.NULL_CELL_WIDTH,v.NULL_CELL_CODE]);for(let k=0;k<g;++k)this.setCell(k,_);this.length=g}get(g){const b=this._data[3*g+0],p=2097151&b;return[this._data[3*g+1],2097152&b?this._combined[g]:p?(0,S.stringFromCodePoint)(p):"",b>>22,2097152&b?this._combined[g].charCodeAt(this._combined[g].length-1):p]}set(g,b){this._data[3*g+1]=b[v.CHAR_DATA_ATTR_INDEX],b[v.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[g]=b[1],this._data[3*g+0]=2097152|g|b[v.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*g+0]=b[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[v.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(g){return this._data[3*g+0]>>22}hasWidth(g){return 12582912&this._data[3*g+0]}getFg(g){return this._data[3*g+1]}getBg(g){return this._data[3*g+2]}hasContent(g){return 4194303&this._data[3*g+0]}getCodePoint(g){const b=this._data[3*g+0];return 2097152&b?this._combined[g].charCodeAt(this._combined[g].length-1):2097151&b}isCombined(g){return 2097152&this._data[3*g+0]}getString(g){const b=this._data[3*g+0];return 2097152&b?this._combined[g]:2097151&b?(0,S.stringFromCodePoint)(2097151&b):""}isProtected(g){return 536870912&this._data[3*g+2]}loadCell(g,b){return w=3*g,b.content=this._data[w+0],b.fg=this._data[w+1],b.bg=this._data[w+2],2097152&b.content&&(b.combinedData=this._combined[g]),268435456&b.bg&&(b.extended=this._extendedAttrs[g]),b}setCell(g,b){2097152&b.content&&(this._combined[g]=b.combinedData),268435456&b.bg&&(this._extendedAttrs[g]=b.extended),this._data[3*g+0]=b.content,this._data[3*g+1]=b.fg,this._data[3*g+2]=b.bg}setCellFromCodepoint(g,b,p,_){268435456&_.bg&&(this._extendedAttrs[g]=_.extended),this._data[3*g+0]=b|p<<22,this._data[3*g+1]=_.fg,this._data[3*g+2]=_.bg}addCodepointToCell(g,b,p){let _=this._data[3*g+0];2097152&_?this._combined[g]+=(0,S.stringFromCodePoint)(b):2097151&_?(this._combined[g]=(0,S.stringFromCodePoint)(2097151&_)+(0,S.stringFromCodePoint)(b),_&=-2097152,_|=2097152):_=b|4194304,p&&(_&=-12582913,_|=p<<22),this._data[3*g+0]=_}insertCells(g,b,p){if((g%=this.length)&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,p),b<this.length-g){const _=new y.CellData;for(let k=this.length-g-b-1;k>=0;--k)this.setCell(g+b+k,this.loadCell(g+k,_));for(let k=0;k<b;++k)this.setCell(g+k,p)}else for(let _=g;_<this.length;++_)this.setCell(_,p);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,p)}deleteCells(g,b,p){if(g%=this.length,b<this.length-g){const _=new y.CellData;for(let k=0;k<this.length-g-b;++k)this.setCell(g+k,this.loadCell(g+b+k,_));for(let k=this.length-b;k<this.length;++k)this.setCell(k,p)}else for(let _=g;_<this.length;++_)this.setCell(_,p);g&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,p),this.getWidth(g)!==0||this.hasContent(g)||this.setCellFromCodepoint(g,0,1,p)}replaceCells(g,b,p,_=!1){if(_)for(g&&this.getWidth(g-1)===2&&!this.isProtected(g-1)&&this.setCellFromCodepoint(g-1,0,1,p),b<this.length&&this.getWidth(b-1)===2&&!this.isProtected(b)&&this.setCellFromCodepoint(b,0,1,p);g<b&&g<this.length;)this.isProtected(g)||this.setCell(g,p),g++;else for(g&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,p),b<this.length&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b,0,1,p);g<b&&g<this.length;)this.setCell(g++,p)}resize(g,b){if(g===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const p=3*g;if(g>this.length){if(this._data.buffer.byteLength>=4*p)this._data=new Uint32Array(this._data.buffer,0,p);else{const _=new Uint32Array(p);_.set(this._data),this._data=_}for(let _=this.length;_<g;++_)this.setCell(_,b)}else{this._data=this._data.subarray(0,p);const _=Object.keys(this._combined);for(let A=0;A<_.length;A++){const C=parseInt(_[A],10);C>=g&&delete this._combined[C]}const k=Object.keys(this._extendedAttrs);for(let A=0;A<k.length;A++){const C=parseInt(k[A],10);C>=g&&delete this._extendedAttrs[C]}}return this.length=g,4*p*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const g=new Uint32Array(this._data.length);return g.set(this._data),this._data=g,1}return 0}fill(g,b=!1){if(b)for(let p=0;p<this.length;++p)this.isProtected(p)||this.setCell(p,g);else{this._combined={},this._extendedAttrs={};for(let p=0;p<this.length;++p)this.setCell(p,g)}}copyFrom(g){this.length!==g.length?this._data=new Uint32Array(g._data):this._data.set(g._data),this.length=g.length,this._combined={};for(const b in g._combined)this._combined[b]=g._combined[b];this._extendedAttrs={};for(const b in g._extendedAttrs)this._extendedAttrs[b]=g._extendedAttrs[b];this.isWrapped=g.isWrapped}clone(){const g=new R(0);g._data=new Uint32Array(this._data),g.length=this.length;for(const b in this._combined)g._combined[b]=this._combined[b];for(const b in this._extendedAttrs)g._extendedAttrs[b]=this._extendedAttrs[b];return g.isWrapped=this.isWrapped,g}getTrimmedLength(){for(let g=this.length-1;g>=0;--g)if(4194303&this._data[3*g+0])return g+(this._data[3*g+0]>>22);return 0}getNoBgTrimmedLength(){for(let g=this.length-1;g>=0;--g)if(4194303&this._data[3*g+0]||50331648&this._data[3*g+2])return g+(this._data[3*g+0]>>22);return 0}copyCellsFrom(g,b,p,_,k){const A=g._data;if(k)for(let N=_-1;N>=0;N--){for(let j=0;j<3;j++)this._data[3*(p+N)+j]=A[3*(b+N)+j];268435456&A[3*(b+N)+2]&&(this._extendedAttrs[p+N]=g._extendedAttrs[b+N])}else for(let N=0;N<_;N++){for(let j=0;j<3;j++)this._data[3*(p+N)+j]=A[3*(b+N)+j];268435456&A[3*(b+N)+2]&&(this._extendedAttrs[p+N]=g._extendedAttrs[b+N])}const C=Object.keys(g._combined);for(let N=0;N<C.length;N++){const j=parseInt(C[N],10);j>=b&&(this._combined[j-b+p]=g._combined[j])}}translateToString(g,b,p,_){b=b??0,p=p??this.length,g&&(p=Math.min(p,this.getTrimmedLength())),_&&(_.length=0);let k="";for(;b<p;){const A=this._data[3*b+0],C=2097151&A,N=2097152&A?this._combined[b]:C?(0,S.stringFromCodePoint)(C):v.WHITESPACE_CELL_CHAR;if(k+=N,_)for(let j=0;j<N.length;++j)_.push(b);b+=A>>22||1}return _&&_.push(b),k}}l.BufferLine=R},4841:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getRangeLength=void 0,l.getRangeLength=function(d,m){if(d.start.y>d.end.y)throw new Error(`Buffer range end (${d.end.x}, ${d.end.y}) cannot be before start (${d.start.x}, ${d.start.y})`);return m*(d.end.y-d.start.y)+(d.end.x-d.start.x+1)}},4634:(f,l)=>{function d(m,y,v){if(y===m.length-1)return m[y].getTrimmedLength();const S=!m[y].hasContent(v-1)&&m[y].getWidth(v-1)===1,w=m[y+1].getWidth(0)===2;return S&&w?v-1:v}Object.defineProperty(l,"__esModule",{value:!0}),l.getWrappedLineTrimmedLength=l.reflowSmallerGetNewLineLengths=l.reflowLargerApplyNewLayout=l.reflowLargerCreateNewLayout=l.reflowLargerGetLinesToRemove=void 0,l.reflowLargerGetLinesToRemove=function(m,y,v,S,w){const R=[];for(let x=0;x<m.length-1;x++){let g=x,b=m.get(++g);if(!b.isWrapped)continue;const p=[m.get(x)];for(;g<m.length&&b.isWrapped;)p.push(b),b=m.get(++g);if(S>=x&&S<g){x+=p.length-1;continue}let _=0,k=d(p,_,y),A=1,C=0;for(;A<p.length;){const j=d(p,A,y),M=j-C,O=v-k,B=Math.min(M,O);p[_].copyCellsFrom(p[A],C,k,B,!1),k+=B,k===v&&(_++,k=0),C+=B,C===j&&(A++,C=0),k===0&&_!==0&&p[_-1].getWidth(v-1)===2&&(p[_].copyCellsFrom(p[_-1],v-1,k++,1,!1),p[_-1].setCell(v-1,w))}p[_].replaceCells(k,v,w);let N=0;for(let j=p.length-1;j>0&&(j>_||p[j].getTrimmedLength()===0);j--)N++;N>0&&(R.push(x+p.length-N),R.push(N)),x+=p.length-1}return R},l.reflowLargerCreateNewLayout=function(m,y){const v=[];let S=0,w=y[S],R=0;for(let x=0;x<m.length;x++)if(w===x){const g=y[++S];m.onDeleteEmitter.fire({index:x-R,amount:g}),x+=g-1,R+=g,w=y[++S]}else v.push(x);return{layout:v,countRemoved:R}},l.reflowLargerApplyNewLayout=function(m,y){const v=[];for(let S=0;S<y.length;S++)v.push(m.get(y[S]));for(let S=0;S<v.length;S++)m.set(S,v[S]);m.length=y.length},l.reflowSmallerGetNewLineLengths=function(m,y,v){const S=[],w=m.map(((b,p)=>d(m,p,y))).reduce(((b,p)=>b+p));let R=0,x=0,g=0;for(;g<w;){if(w-g<v){S.push(w-g);break}R+=v;const b=d(m,x,y);R>b&&(R-=b,x++);const p=m[x].getWidth(R-1)===2;p&&R--;const _=p?v-1:v;S.push(_),g+=_}return S},l.getWrappedLineTrimmedLength=d},5295:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferSet=void 0;const m=d(8460),y=d(844),v=d(9092);class S extends y.Disposable{constructor(R,x){super(),this._optionsService=R,this._bufferService=x,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 v.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new v.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(R){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(R),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(R,x){this._normal.resize(R,x),this._alt.resize(R,x),this.setupTabStops(R)}setupTabStops(R){this._normal.setupTabStops(R),this._alt.setupTabStops(R)}}l.BufferSet=S},511:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CellData=void 0;const m=d(482),y=d(643),v=d(3734);class S extends v.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new v.ExtendedAttrs,this.combinedData=""}static fromCharData(R){const x=new S;return x.setFromCharData(R),x}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(R){this.fg=R[y.CHAR_DATA_ATTR_INDEX],this.bg=0;let x=!1;if(R[y.CHAR_DATA_CHAR_INDEX].length>2)x=!0;else if(R[y.CHAR_DATA_CHAR_INDEX].length===2){const g=R[y.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=g&&g<=56319){const b=R[y.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(g-55296)+b-56320+65536|R[y.CHAR_DATA_WIDTH_INDEX]<<22:x=!0}else x=!0}else this.content=R[y.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|R[y.CHAR_DATA_WIDTH_INDEX]<<22;x&&(this.combinedData=R[y.CHAR_DATA_CHAR_INDEX],this.content=2097152|R[y.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.CellData=S},643:(f,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:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Marker=void 0;const m=d(8460),y=d(844);class v{get id(){return this._id}constructor(w){this.line=w,this.isDisposed=!1,this._disposables=[],this._id=v._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,y.disposeArray)(this._disposables),this._disposables.length=0)}register(w){return this._disposables.push(w),w}}l.Marker=v,v._nextId=1},7116:(f,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:(f,l)=>{var d,m,y;Object.defineProperty(l,"__esModule",{value:!0}),l.C1_ESCAPED=l.C1=l.C0=void 0,(function(v){v.NUL="\0",v.SOH="",v.STX="",v.ETX="",v.EOT="",v.ENQ="",v.ACK="",v.BEL="\x07",v.BS="\b",v.HT=" ",v.LF=`
485
+ `,v.VT="\v",v.FF="\f",v.CR="\r",v.SO="",v.SI="",v.DLE="",v.DC1="",v.DC2="",v.DC3="",v.DC4="",v.NAK="",v.SYN="",v.ETB="",v.CAN="",v.EM="",v.SUB="",v.ESC="\x1B",v.FS="",v.GS="",v.RS="",v.US="",v.SP=" ",v.DEL=""})(d||(l.C0=d={})),(function(v){v.PAD="€",v.HOP="",v.BPH="‚",v.NBH="ƒ",v.IND="„",v.NEL="…",v.SSA="†",v.ESA="‡",v.HTS="ˆ",v.HTJ="‰",v.VTS="Š",v.PLD="‹",v.PLU="Œ",v.RI="",v.SS2="Ž",v.SS3="",v.DCS="",v.PU1="‘",v.PU2="’",v.STS="“",v.CCH="”",v.MW="•",v.SPA="–",v.EPA="—",v.SOS="˜",v.SGCI="™",v.SCI="š",v.CSI="›",v.ST="œ",v.OSC="",v.PM="ž",v.APC="Ÿ"})(m||(l.C1=m={})),(function(v){v.ST=`${d.ESC}\\`})(y||(l.C1_ESCAPED=y={}))},7399:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.evaluateKeyboardEvent=void 0;const m=d(2584),y={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(v,S,w,R){const x={type:0,cancel:!1,key:void 0},g=(v.shiftKey?1:0)|(v.altKey?2:0)|(v.ctrlKey?4:0)|(v.metaKey?8:0);switch(v.keyCode){case 0:v.key==="UIKeyInputUpArrow"?x.key=S?m.C0.ESC+"OA":m.C0.ESC+"[A":v.key==="UIKeyInputLeftArrow"?x.key=S?m.C0.ESC+"OD":m.C0.ESC+"[D":v.key==="UIKeyInputRightArrow"?x.key=S?m.C0.ESC+"OC":m.C0.ESC+"[C":v.key==="UIKeyInputDownArrow"&&(x.key=S?m.C0.ESC+"OB":m.C0.ESC+"[B");break;case 8:x.key=v.ctrlKey?"\b":m.C0.DEL,v.altKey&&(x.key=m.C0.ESC+x.key);break;case 9:if(v.shiftKey){x.key=m.C0.ESC+"[Z";break}x.key=m.C0.HT,x.cancel=!0;break;case 13:x.key=v.altKey?m.C0.ESC+m.C0.CR:m.C0.CR,x.cancel=!0;break;case 27:x.key=m.C0.ESC,v.altKey&&(x.key=m.C0.ESC+m.C0.ESC),x.cancel=!0;break;case 37:if(v.metaKey)break;g?(x.key=m.C0.ESC+"[1;"+(g+1)+"D",x.key===m.C0.ESC+"[1;3D"&&(x.key=m.C0.ESC+(w?"b":"[1;5D"))):x.key=S?m.C0.ESC+"OD":m.C0.ESC+"[D";break;case 39:if(v.metaKey)break;g?(x.key=m.C0.ESC+"[1;"+(g+1)+"C",x.key===m.C0.ESC+"[1;3C"&&(x.key=m.C0.ESC+(w?"f":"[1;5C"))):x.key=S?m.C0.ESC+"OC":m.C0.ESC+"[C";break;case 38:if(v.metaKey)break;g?(x.key=m.C0.ESC+"[1;"+(g+1)+"A",w||x.key!==m.C0.ESC+"[1;3A"||(x.key=m.C0.ESC+"[1;5A")):x.key=S?m.C0.ESC+"OA":m.C0.ESC+"[A";break;case 40:if(v.metaKey)break;g?(x.key=m.C0.ESC+"[1;"+(g+1)+"B",w||x.key!==m.C0.ESC+"[1;3B"||(x.key=m.C0.ESC+"[1;5B")):x.key=S?m.C0.ESC+"OB":m.C0.ESC+"[B";break;case 45:v.shiftKey||v.ctrlKey||(x.key=m.C0.ESC+"[2~");break;case 46:x.key=g?m.C0.ESC+"[3;"+(g+1)+"~":m.C0.ESC+"[3~";break;case 36:x.key=g?m.C0.ESC+"[1;"+(g+1)+"H":S?m.C0.ESC+"OH":m.C0.ESC+"[H";break;case 35:x.key=g?m.C0.ESC+"[1;"+(g+1)+"F":S?m.C0.ESC+"OF":m.C0.ESC+"[F";break;case 33:v.shiftKey?x.type=2:v.ctrlKey?x.key=m.C0.ESC+"[5;"+(g+1)+"~":x.key=m.C0.ESC+"[5~";break;case 34:v.shiftKey?x.type=3:v.ctrlKey?x.key=m.C0.ESC+"[6;"+(g+1)+"~":x.key=m.C0.ESC+"[6~";break;case 112:x.key=g?m.C0.ESC+"[1;"+(g+1)+"P":m.C0.ESC+"OP";break;case 113:x.key=g?m.C0.ESC+"[1;"+(g+1)+"Q":m.C0.ESC+"OQ";break;case 114:x.key=g?m.C0.ESC+"[1;"+(g+1)+"R":m.C0.ESC+"OR";break;case 115:x.key=g?m.C0.ESC+"[1;"+(g+1)+"S":m.C0.ESC+"OS";break;case 116:x.key=g?m.C0.ESC+"[15;"+(g+1)+"~":m.C0.ESC+"[15~";break;case 117:x.key=g?m.C0.ESC+"[17;"+(g+1)+"~":m.C0.ESC+"[17~";break;case 118:x.key=g?m.C0.ESC+"[18;"+(g+1)+"~":m.C0.ESC+"[18~";break;case 119:x.key=g?m.C0.ESC+"[19;"+(g+1)+"~":m.C0.ESC+"[19~";break;case 120:x.key=g?m.C0.ESC+"[20;"+(g+1)+"~":m.C0.ESC+"[20~";break;case 121:x.key=g?m.C0.ESC+"[21;"+(g+1)+"~":m.C0.ESC+"[21~";break;case 122:x.key=g?m.C0.ESC+"[23;"+(g+1)+"~":m.C0.ESC+"[23~";break;case 123:x.key=g?m.C0.ESC+"[24;"+(g+1)+"~":m.C0.ESC+"[24~";break;default:if(!v.ctrlKey||v.shiftKey||v.altKey||v.metaKey)if(w&&!R||!v.altKey||v.metaKey)!w||v.altKey||v.ctrlKey||v.shiftKey||!v.metaKey?v.key&&!v.ctrlKey&&!v.altKey&&!v.metaKey&&v.keyCode>=48&&v.key.length===1?x.key=v.key:v.key&&v.ctrlKey&&(v.key==="_"&&(x.key=m.C0.US),v.key==="@"&&(x.key=m.C0.NUL)):v.keyCode===65&&(x.type=1);else{const b=y[v.keyCode],p=b==null?void 0:b[v.shiftKey?1:0];if(p)x.key=m.C0.ESC+p;else if(v.keyCode>=65&&v.keyCode<=90){const _=v.ctrlKey?v.keyCode-64:v.keyCode+32;let k=String.fromCharCode(_);v.shiftKey&&(k=k.toUpperCase()),x.key=m.C0.ESC+k}else if(v.keyCode===32)x.key=m.C0.ESC+(v.ctrlKey?m.C0.NUL:" ");else if(v.key==="Dead"&&v.code.startsWith("Key")){let _=v.code.slice(3,4);v.shiftKey||(_=_.toLowerCase()),x.key=m.C0.ESC+_,x.cancel=!0}}else v.keyCode>=65&&v.keyCode<=90?x.key=String.fromCharCode(v.keyCode-64):v.keyCode===32?x.key=m.C0.NUL:v.keyCode>=51&&v.keyCode<=55?x.key=String.fromCharCode(v.keyCode-51+27):v.keyCode===56?x.key=m.C0.DEL:v.keyCode===219?x.key=m.C0.ESC:v.keyCode===220?x.key=m.C0.FS:v.keyCode===221&&(x.key=m.C0.GS)}return x}},482:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Utf8ToUtf32=l.StringToUtf32=l.utf32ToString=l.stringFromCodePoint=void 0,l.stringFromCodePoint=function(d){return d>65535?(d-=65536,String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):String.fromCharCode(d)},l.utf32ToString=function(d,m=0,y=d.length){let v="";for(let S=m;S<y;++S){let w=d[S];w>65535?(w-=65536,v+=String.fromCharCode(55296+(w>>10))+String.fromCharCode(w%1024+56320)):v+=String.fromCharCode(w)}return v},l.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(d,m){const y=d.length;if(!y)return 0;let v=0,S=0;if(this._interim){const w=d.charCodeAt(S++);56320<=w&&w<=57343?m[v++]=1024*(this._interim-55296)+w-56320+65536:(m[v++]=this._interim,m[v++]=w),this._interim=0}for(let w=S;w<y;++w){const R=d.charCodeAt(w);if(55296<=R&&R<=56319){if(++w>=y)return this._interim=R,v;const x=d.charCodeAt(w);56320<=x&&x<=57343?m[v++]=1024*(R-55296)+x-56320+65536:(m[v++]=R,m[v++]=x)}else R!==65279&&(m[v++]=R)}return v}},l.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(d,m){const y=d.length;if(!y)return 0;let v,S,w,R,x=0,g=0,b=0;if(this.interim[0]){let k=!1,A=this.interim[0];A&=(224&A)==192?31:(240&A)==224?15:7;let C,N=0;for(;(C=63&this.interim[++N])&&N<4;)A<<=6,A|=C;const j=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,M=j-N;for(;b<M;){if(b>=y)return 0;if(C=d[b++],(192&C)!=128){b--,k=!0;break}this.interim[N++]=C,A<<=6,A|=63&C}k||(j===2?A<128?b--:m[x++]=A:j===3?A<2048||A>=55296&&A<=57343||A===65279||(m[x++]=A):A<65536||A>1114111||(m[x++]=A)),this.interim.fill(0)}const p=y-4;let _=b;for(;_<y;){for(;!(!(_<p)||128&(v=d[_])||128&(S=d[_+1])||128&(w=d[_+2])||128&(R=d[_+3]));)m[x++]=v,m[x++]=S,m[x++]=w,m[x++]=R,_+=4;if(v=d[_++],v<128)m[x++]=v;else if((224&v)==192){if(_>=y)return this.interim[0]=v,x;if(S=d[_++],(192&S)!=128){_--;continue}if(g=(31&v)<<6|63&S,g<128){_--;continue}m[x++]=g}else if((240&v)==224){if(_>=y)return this.interim[0]=v,x;if(S=d[_++],(192&S)!=128){_--;continue}if(_>=y)return this.interim[0]=v,this.interim[1]=S,x;if(w=d[_++],(192&w)!=128){_--;continue}if(g=(15&v)<<12|(63&S)<<6|63&w,g<2048||g>=55296&&g<=57343||g===65279)continue;m[x++]=g}else if((248&v)==240){if(_>=y)return this.interim[0]=v,x;if(S=d[_++],(192&S)!=128){_--;continue}if(_>=y)return this.interim[0]=v,this.interim[1]=S,x;if(w=d[_++],(192&w)!=128){_--;continue}if(_>=y)return this.interim[0]=v,this.interim[1]=S,this.interim[2]=w,x;if(R=d[_++],(192&R)!=128){_--;continue}if(g=(7&v)<<18|(63&S)<<12|(63&w)<<6|63&R,g<65536||g>1114111)continue;m[x++]=g}}return x}}},225:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const m=d(1480),y=[[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]],v=[[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 w=0;w<y.length;++w)S.fill(0,y[w][0],y[w][1]+1)}}wcwidth(w){return w<32?0:w<127?1:w<65536?S[w]:(function(R,x){let g,b=0,p=x.length-1;if(R<x[0][0]||R>x[p][1])return!1;for(;p>=b;)if(g=b+p>>1,R>x[g][1])b=g+1;else{if(!(R<x[g][0]))return!0;p=g-1}return!1})(w,v)?0:w>=131072&&w<=196605||w>=196608&&w<=262141?2:1}charProperties(w,R){let x=this.wcwidth(w),g=x===0&&R!==0;if(g){const b=m.UnicodeService.extractWidth(R);b===0?g=!1:b>x&&(x=b)}return m.UnicodeService.createPropertyValue(0,x,g)}}},5981:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WriteBuffer=void 0;const m=d(8460),y=d(844);class v extends y.Disposable{constructor(w){super(),this._action=w,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(w,R){if(R!==void 0&&this._syncCalls>R)return void(this._syncCalls=0);if(this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let x;for(this._isSyncWriting=!0;x=this._writeBuffer.shift();){this._action(x);const g=this._callbacks.shift();g&&g()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(w,R){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+=w.length,this._writeBuffer.push(w),this._callbacks.push(R),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(R)}_innerWrite(w=0,R=!0){const x=w||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const g=this._writeBuffer[this._bufferOffset],b=this._action(g,R);if(b){const _=k=>Date.now()-x>=12?setTimeout((()=>this._innerWrite(0,k))):this._innerWrite(x,k);return void b.catch((k=>(queueMicrotask((()=>{throw k})),Promise.resolve(!1)))).then(_)}const p=this._callbacks[this._bufferOffset];if(p&&p(),this._bufferOffset++,this._pendingData-=g.length,Date.now()-x>=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=v},5941:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.toRgbString=l.parseColor=void 0;const d=/^([\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 y(v,S){const w=v.toString(16),R=w.length<2?"0"+w:w;switch(S){case 4:return w[0];case 8:return R;case 12:return(R+R).slice(0,3);default:return R+R}}l.parseColor=function(v){if(!v)return;let S=v.toLowerCase();if(S.indexOf("rgb:")===0){S=S.slice(4);const w=d.exec(S);if(w){const R=w[1]?15:w[4]?255:w[7]?4095:65535;return[Math.round(parseInt(w[1]||w[4]||w[7]||w[10],16)/R*255),Math.round(parseInt(w[2]||w[5]||w[8]||w[11],16)/R*255),Math.round(parseInt(w[3]||w[6]||w[9]||w[12],16)/R*255)]}}else if(S.indexOf("#")===0&&(S=S.slice(1),m.exec(S)&&[3,6,9,12].includes(S.length))){const w=S.length/3,R=[0,0,0];for(let x=0;x<3;++x){const g=parseInt(S.slice(w*x,w*x+w),16);R[x]=w===1?g<<4:w===2?g:w===3?g>>4:g>>8}return R}},l.toRgbString=function(v,S=16){const[w,R,x]=v;return`rgb:${y(w,S)}/${y(R,S)}/${y(x,S)}`}},5770:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PAYLOAD_LIMIT=void 0,l.PAYLOAD_LIMIT=1e7},6351:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DcsHandler=l.DcsParser=void 0;const m=d(482),y=d(8742),v=d(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(R,x){this._handlers[R]===void 0&&(this._handlers[R]=[]);const g=this._handlers[R];return g.push(x),{dispose:()=>{const b=g.indexOf(x);b!==-1&&g.splice(b,1)}}}clearHandler(R){this._handlers[R]&&delete this._handlers[R]}setHandlerFallback(R){this._handlerFb=R}reset(){if(this._active.length)for(let R=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;R>=0;--R)this._active[R].unhook(!1);this._stack.paused=!1,this._active=S,this._ident=0}hook(R,x){if(this.reset(),this._ident=R,this._active=this._handlers[R]||S,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].hook(x);else this._handlerFb(this._ident,"HOOK",x)}put(R,x,g){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(R,x,g);else this._handlerFb(this._ident,"PUT",(0,m.utf32ToString)(R,x,g))}unhook(R,x=!0){if(this._active.length){let g=!1,b=this._active.length-1,p=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,g=x,p=this._stack.fallThrough,this._stack.paused=!1),!p&&g===!1){for(;b>=0&&(g=this._active[b].unhook(R),g!==!0);b--)if(g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,g;b--}for(;b>=0;b--)if(g=this._active[b].unhook(!1),g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,g}else this._handlerFb(this._ident,"UNHOOK",R);this._active=S,this._ident=0}};const w=new y.Params;w.addParam(0),l.DcsHandler=class{constructor(R){this._handler=R,this._data="",this._params=w,this._hitLimit=!1}hook(R){this._params=R.length>1||R.params[0]?R.clone():w,this._data="",this._hitLimit=!1}put(R,x,g){this._hitLimit||(this._data+=(0,m.utf32ToString)(R,x,g),this._data.length>v.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(R){let x=!1;if(this._hitLimit)x=!1;else if(R&&(x=this._handler(this._data,this._params),x instanceof Promise))return x.then((g=>(this._params=w,this._data="",this._hitLimit=!1,g)));return this._params=w,this._data="",this._hitLimit=!1,x}}},2015:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.EscapeSequenceParser=l.VT500_TRANSITION_TABLE=l.TransitionTable=void 0;const m=d(844),y=d(8742),v=d(6242),S=d(6351);class w{constructor(b){this.table=new Uint8Array(b)}setDefault(b,p){this.table.fill(b<<4|p)}add(b,p,_,k){this.table[p<<8|b]=_<<4|k}addMany(b,p,_,k){for(let A=0;A<b.length;A++)this.table[p<<8|b[A]]=_<<4|k}}l.TransitionTable=w;const R=160;l.VT500_TRANSITION_TABLE=(function(){const g=new w(4095),b=Array.apply(null,Array(256)).map(((N,j)=>j)),p=(N,j)=>b.slice(N,j),_=p(32,127),k=p(0,24);k.push(25),k.push.apply(k,p(28,32));const A=p(0,14);let C;for(C in g.setDefault(1,0),g.addMany(_,0,2,0),A)g.addMany([24,26,153,154],C,3,0),g.addMany(p(128,144),C,3,0),g.addMany(p(144,152),C,3,0),g.add(156,C,0,0),g.add(27,C,11,1),g.add(157,C,4,8),g.addMany([152,158,159],C,0,7),g.add(155,C,11,3),g.add(144,C,11,9);return g.addMany(k,0,3,0),g.addMany(k,1,3,1),g.add(127,1,0,1),g.addMany(k,8,0,8),g.addMany(k,3,3,3),g.add(127,3,0,3),g.addMany(k,4,3,4),g.add(127,4,0,4),g.addMany(k,6,3,6),g.addMany(k,5,3,5),g.add(127,5,0,5),g.addMany(k,2,3,2),g.add(127,2,0,2),g.add(93,1,4,8),g.addMany(_,8,5,8),g.add(127,8,5,8),g.addMany([156,27,24,26,7],8,6,0),g.addMany(p(28,32),8,0,8),g.addMany([88,94,95],1,0,7),g.addMany(_,7,0,7),g.addMany(k,7,0,7),g.add(156,7,0,0),g.add(127,7,0,7),g.add(91,1,11,3),g.addMany(p(64,127),3,7,0),g.addMany(p(48,60),3,8,4),g.addMany([60,61,62,63],3,9,4),g.addMany(p(48,60),4,8,4),g.addMany(p(64,127),4,7,0),g.addMany([60,61,62,63],4,0,6),g.addMany(p(32,64),6,0,6),g.add(127,6,0,6),g.addMany(p(64,127),6,0,0),g.addMany(p(32,48),3,9,5),g.addMany(p(32,48),5,9,5),g.addMany(p(48,64),5,0,6),g.addMany(p(64,127),5,7,0),g.addMany(p(32,48),4,9,5),g.addMany(p(32,48),1,9,2),g.addMany(p(32,48),2,9,2),g.addMany(p(48,127),2,10,0),g.addMany(p(48,80),1,10,0),g.addMany(p(81,88),1,10,0),g.addMany([89,90,92],1,10,0),g.addMany(p(96,127),1,10,0),g.add(80,1,11,9),g.addMany(k,9,0,9),g.add(127,9,0,9),g.addMany(p(28,32),9,0,9),g.addMany(p(32,48),9,9,12),g.addMany(p(48,60),9,8,10),g.addMany([60,61,62,63],9,9,10),g.addMany(k,11,0,11),g.addMany(p(32,128),11,0,11),g.addMany(p(28,32),11,0,11),g.addMany(k,10,0,10),g.add(127,10,0,10),g.addMany(p(28,32),10,0,10),g.addMany(p(48,60),10,8,10),g.addMany([60,61,62,63],10,0,11),g.addMany(p(32,48),10,9,12),g.addMany(k,12,0,12),g.add(127,12,0,12),g.addMany(p(28,32),12,0,12),g.addMany(p(32,48),12,9,12),g.addMany(p(48,64),12,0,11),g.addMany(p(64,127),12,12,13),g.addMany(p(64,127),10,12,13),g.addMany(p(64,127),9,12,13),g.addMany(k,13,13,13),g.addMany(_,13,13,13),g.add(127,13,0,13),g.addMany([27,156,24,26],13,14,0),g.add(R,0,2,0),g.add(R,8,5,8),g.add(R,6,0,6),g.add(R,11,0,11),g.add(R,13,13,13),g})();class x 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 y.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(p,_,k)=>{},this._executeHandlerFb=p=>{},this._csiHandlerFb=(p,_)=>{},this._escHandlerFb=p=>{},this._errorHandlerFb=p=>p,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 v.OscParser),this._dcsParser=this.register(new S.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,p=[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 A=0;A<b.intermediates.length;++A){const C=b.intermediates.charCodeAt(A);if(32>C||C>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");_<<=8,_|=C}}if(b.final.length!==1)throw new Error("final must be a single byte");const k=b.final.charCodeAt(0);if(p[0]>k||k>p[1])throw new Error(`final must be in range ${p[0]} .. ${p[1]}`);return _<<=8,_|=k,_}identToString(b){const p=[];for(;b;)p.push(String.fromCharCode(255&b)),b>>=8;return p.reverse().join("")}setPrintHandler(b){this._printHandler=b}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(b,p){const _=this._identifier(b,[48,126]);this._escHandlers[_]===void 0&&(this._escHandlers[_]=[]);const k=this._escHandlers[_];return k.push(p),{dispose:()=>{const A=k.indexOf(p);A!==-1&&k.splice(A,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,p){this._executeHandlers[b.charCodeAt(0)]=p}clearExecuteHandler(b){this._executeHandlers[b.charCodeAt(0)]&&delete this._executeHandlers[b.charCodeAt(0)]}setExecuteHandlerFallback(b){this._executeHandlerFb=b}registerCsiHandler(b,p){const _=this._identifier(b);this._csiHandlers[_]===void 0&&(this._csiHandlers[_]=[]);const k=this._csiHandlers[_];return k.push(p),{dispose:()=>{const A=k.indexOf(p);A!==-1&&k.splice(A,1)}}}clearCsiHandler(b){this._csiHandlers[this._identifier(b)]&&delete this._csiHandlers[this._identifier(b)]}setCsiHandlerFallback(b){this._csiHandlerFb=b}registerDcsHandler(b,p){return this._dcsParser.registerHandler(this._identifier(b),p)}clearDcsHandler(b){this._dcsParser.clearHandler(this._identifier(b))}setDcsHandlerFallback(b){this._dcsParser.setHandlerFallback(b)}registerOscHandler(b,p){return this._oscParser.registerHandler(b,p)}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,p,_,k,A){this._parseStack.state=b,this._parseStack.handlers=p,this._parseStack.handlerPos=_,this._parseStack.transition=k,this._parseStack.chunkPos=A}parse(b,p,_){let k,A=0,C=0,N=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,N=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(A=b[this._parseStack.chunkPos],k=this._dcsParser.unhook(A!==24&&A!==26,_),k)return k;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(A=b[this._parseStack.chunkPos],k=this._oscParser.end(A!==24&&A!==26,_),k)return k;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,N=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let j=N;j<p;++j){switch(A=b[j],C=this._transitions.table[this.currentState<<8|(A<160?A:R)],C>>4){case 2:for(let V=j+1;;++V){if(V>=p||(A=b[V])<32||A>126&&A<R){this._printHandler(b,j,V),j=V-1;break}if(++V>=p||(A=b[V])<32||A>126&&A<R){this._printHandler(b,j,V),j=V-1;break}if(++V>=p||(A=b[V])<32||A>126&&A<R){this._printHandler(b,j,V),j=V-1;break}if(++V>=p||(A=b[V])<32||A>126&&A<R){this._printHandler(b,j,V),j=V-1;break}}break;case 3:this._executeHandlers[A]?this._executeHandlers[A]():this._executeHandlerFb(A),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:j,code:A,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const M=this._csiHandlers[this._collect<<8|A];let O=M?M.length-1:-1;for(;O>=0&&(k=M[O](this._params),k!==!0);O--)if(k instanceof Promise)return this._preserveStack(3,M,O,C,j),k;O<0&&this._csiHandlerFb(this._collect<<8|A,this._params),this.precedingJoinState=0;break;case 8:do switch(A){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(A-48)}while(++j<p&&(A=b[j])>47&&A<60);j--;break;case 9:this._collect<<=8,this._collect|=A;break;case 10:const B=this._escHandlers[this._collect<<8|A];let q=B?B.length-1:-1;for(;q>=0&&(k=B[q](),k!==!0);q--)if(k instanceof Promise)return this._preserveStack(4,B,q,C,j),k;q<0&&this._escHandlerFb(this._collect<<8|A),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|A,this._params);break;case 13:for(let V=j+1;;++V)if(V>=p||(A=b[V])===24||A===26||A===27||A>127&&A<R){this._dcsParser.put(b,j,V),j=V-1;break}break;case 14:if(k=this._dcsParser.unhook(A!==24&&A!==26),k)return this._preserveStack(6,[],0,C,j),k;A===27&&(C|=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 V=j+1;;V++)if(V>=p||(A=b[V])<32||A>127&&A<R){this._oscParser.put(b,j,V),j=V-1;break}break;case 6:if(k=this._oscParser.end(A!==24&&A!==26),k)return this._preserveStack(5,[],0,C,j),k;A===27&&(C|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&C}}}l.EscapeSequenceParser=x},6242:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OscHandler=l.OscParser=void 0;const m=d(5770),y=d(482),v=[];l.OscParser=class{constructor(){this._state=0,this._active=v,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(S,w){this._handlers[S]===void 0&&(this._handlers[S]=[]);const R=this._handlers[S];return R.push(w),{dispose:()=>{const x=R.indexOf(w);x!==-1&&R.splice(x,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=v}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=v,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||v,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,w,R){if(this._active.length)for(let x=this._active.length-1;x>=0;x--)this._active[x].put(S,w,R);else this._handlerFb(this._id,"PUT",(0,y.utf32ToString)(S,w,R))}start(){this.reset(),this._state=1}put(S,w,R){if(this._state!==3){if(this._state===1)for(;w<R;){const x=S[w++];if(x===59){this._state=2,this._start();break}if(x<48||57<x)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+x-48}this._state===2&&R-w>0&&this._put(S,w,R)}}end(S,w=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let R=!1,x=this._active.length-1,g=!1;if(this._stack.paused&&(x=this._stack.loopPosition-1,R=w,g=this._stack.fallThrough,this._stack.paused=!1),!g&&R===!1){for(;x>=0&&(R=this._active[x].end(S),R!==!0);x--)if(R instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=x,this._stack.fallThrough=!1,R;x--}for(;x>=0;x--)if(R=this._active[x].end(!1),R instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=x,this._stack.fallThrough=!0,R}else this._handlerFb(this._id,"END",S);this._active=v,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,w,R){this._hitLimit||(this._data+=(0,y.utf32ToString)(S,w,R),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(S){let w=!1;if(this._hitLimit)w=!1;else if(S&&(w=this._handler(this._data),w instanceof Promise))return w.then((R=>(this._data="",this._hitLimit=!1,R)));return this._data="",this._hitLimit=!1,w}}},8742:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Params=void 0;const d=2147483647;class m{static fromArray(v){const S=new m;if(!v.length)return S;for(let w=Array.isArray(v[0])?1:0;w<v.length;++w){const R=v[w];if(Array.isArray(R))for(let x=0;x<R.length;++x)S.addSubParam(R[x]);else S.addParam(R)}return S}constructor(v=32,S=32){if(this.maxLength=v,this.maxSubParamsLength=S,S>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(v),this.length=0,this._subParams=new Int32Array(S),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(v),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const v=new m(this.maxLength,this.maxSubParamsLength);return v.params.set(this.params),v.length=this.length,v._subParams.set(this._subParams),v._subParamsLength=this._subParamsLength,v._subParamsIdx.set(this._subParamsIdx),v._rejectDigits=this._rejectDigits,v._rejectSubDigits=this._rejectSubDigits,v._digitIsSub=this._digitIsSub,v}toArray(){const v=[];for(let S=0;S<this.length;++S){v.push(this.params[S]);const w=this._subParamsIdx[S]>>8,R=255&this._subParamsIdx[S];R-w>0&&v.push(Array.prototype.slice.call(this._subParams,w,R))}return v}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(v){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(v<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=v>d?d:v}}addSubParam(v){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(v<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=v>d?d:v,this._subParamsIdx[this.length-1]++}}hasSubParams(v){return(255&this._subParamsIdx[v])-(this._subParamsIdx[v]>>8)>0}getSubParams(v){const S=this._subParamsIdx[v]>>8,w=255&this._subParamsIdx[v];return w-S>0?this._subParams.subarray(S,w):null}getSubParamsAll(){const v={};for(let S=0;S<this.length;++S){const w=this._subParamsIdx[S]>>8,R=255&this._subParamsIdx[S];R-w>0&&(v[S]=this._subParams.slice(w,R))}return v}addDigit(v){let S;if(this._rejectDigits||!(S=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const w=this._digitIsSub?this._subParams:this.params,R=w[S-1];w[S-1]=~R?Math.min(10*R+v,d):v}}l.Params=m},5741:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AddonManager=void 0,l.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let d=this._addons.length-1;d>=0;d--)this._addons[d].instance.dispose()}loadAddon(d,m){const y={instance:m,dispose:m.dispose,isDisposed:!1};this._addons.push(y),m.dispose=()=>this._wrappedAddonDispose(y),m.activate(d)}_wrappedAddonDispose(d){if(d.isDisposed)return;let m=-1;for(let y=0;y<this._addons.length;y++)if(this._addons[y]===d){m=y;break}if(m===-1)throw new Error("Could not dispose an addon that has not been loaded");d.isDisposed=!0,d.dispose.apply(d.instance),this._addons.splice(m,1)}}},8771:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferApiView=void 0;const m=d(3785),y=d(511);l.BufferApiView=class{constructor(v,S){this._buffer=v,this.type=S}init(v){return this._buffer=v,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(v){const S=this._buffer.lines.get(v);if(S)return new m.BufferLineApiView(S)}getNullCell(){return new y.CellData}}},3785:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLineApiView=void 0;const m=d(511);l.BufferLineApiView=class{constructor(y){this._line=y}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(y,v){if(!(y<0||y>=this._line.length))return v?(this._line.loadCell(y,v),v):this._line.loadCell(y,new m.CellData)}translateToString(y,v,S){return this._line.translateToString(y,v,S)}}},8285:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferNamespaceApi=void 0;const m=d(8771),y=d(8460),v=d(844);class S extends v.Disposable{constructor(R){super(),this._core=R,this._onBufferChange=this.register(new y.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:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ParserApi=void 0,l.ParserApi=class{constructor(d){this._core=d}registerCsiHandler(d,m){return this._core.registerCsiHandler(d,(y=>m(y.toArray())))}addCsiHandler(d,m){return this.registerCsiHandler(d,m)}registerDcsHandler(d,m){return this._core.registerDcsHandler(d,((y,v)=>m(y,v.toArray())))}addDcsHandler(d,m){return this.registerDcsHandler(d,m)}registerEscHandler(d,m){return this._core.registerEscHandler(d,m)}addEscHandler(d,m){return this.registerEscHandler(d,m)}registerOscHandler(d,m){return this._core.registerOscHandler(d,m)}addOscHandler(d,m){return this.registerOscHandler(d,m)}}},7090:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeApi=void 0,l.UnicodeApi=class{constructor(d){this._core=d}register(d){this._core.unicodeService.register(d)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(d){this._core.unicodeService.activeVersion=d}}},744:function(f,l,d){var m=this&&this.__decorate||function(g,b,p,_){var k,A=arguments.length,C=A<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,p):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(g,b,p,_);else for(var N=g.length-1;N>=0;N--)(k=g[N])&&(C=(A<3?k(C):A>3?k(b,p,C):k(b,p))||C);return A>3&&C&&Object.defineProperty(b,p,C),C},y=this&&this.__param||function(g,b){return function(p,_){b(p,_,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferService=l.MINIMUM_ROWS=l.MINIMUM_COLS=void 0;const v=d(8460),S=d(844),w=d(5295),R=d(2585);l.MINIMUM_COLS=2,l.MINIMUM_ROWS=1;let x=l.BufferService=class extends S.Disposable{get buffer(){return this.buffers.active}constructor(g){super(),this.isUserScrolling=!1,this._onResize=this.register(new v.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new v.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(g.rawOptions.cols||0,l.MINIMUM_COLS),this.rows=Math.max(g.rawOptions.rows||0,l.MINIMUM_ROWS),this.buffers=this.register(new w.BufferSet(g,this))}resize(g,b){this.cols=g,this.rows=b,this.buffers.resize(g,b),this._onResize.fire({cols:g,rows:b})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(g,b=!1){const p=this.buffer;let _;_=this._cachedBlankLine,_&&_.length===this.cols&&_.getFg(0)===g.fg&&_.getBg(0)===g.bg||(_=p.getBlankLine(g,b),this._cachedBlankLine=_),_.isWrapped=b;const k=p.ybase+p.scrollTop,A=p.ybase+p.scrollBottom;if(p.scrollTop===0){const C=p.lines.isFull;A===p.lines.length-1?C?p.lines.recycle().copyFrom(_):p.lines.push(_.clone()):p.lines.splice(A+1,0,_.clone()),C?this.isUserScrolling&&(p.ydisp=Math.max(p.ydisp-1,0)):(p.ybase++,this.isUserScrolling||p.ydisp++)}else{const C=A-k+1;p.lines.shiftElements(k+1,C-1,-1),p.lines.set(A,_.clone())}this.isUserScrolling||(p.ydisp=p.ybase),this._onScroll.fire(p.ydisp)}scrollLines(g,b,p){const _=this.buffer;if(g<0){if(_.ydisp===0)return;this.isUserScrolling=!0}else g+_.ydisp>=_.ybase&&(this.isUserScrolling=!1);const k=_.ydisp;_.ydisp=Math.max(Math.min(_.ydisp+g,_.ybase),0),k!==_.ydisp&&(b||this._onScroll.fire(_.ydisp))}};l.BufferService=x=m([y(0,R.IOptionsService)],x)},7994:(f,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(d){this.glevel=d,this.charset=this._charsets[d]}setgCharset(d,m){this._charsets[d]=m,this.glevel===d&&(this.charset=m)}}},1753:function(f,l,d){var m=this&&this.__decorate||function(_,k,A,C){var N,j=arguments.length,M=j<3?k:C===null?C=Object.getOwnPropertyDescriptor(k,A):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(_,k,A,C);else for(var O=_.length-1;O>=0;O--)(N=_[O])&&(M=(j<3?N(M):j>3?N(k,A,M):N(k,A))||M);return j>3&&M&&Object.defineProperty(k,A,M),M},y=this&&this.__param||function(_,k){return function(A,C){k(A,C,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreMouseService=void 0;const v=d(2585),S=d(8460),w=d(844),R={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 x(_,k){let A=(_.ctrl?16:0)|(_.shift?4:0)|(_.alt?8:0);return _.button===4?(A|=64,A|=_.action):(A|=3&_.button,4&_.button&&(A|=64),8&_.button&&(A|=128),_.action===32?A|=32:_.action!==0||k||(A|=3)),A}const g=String.fromCharCode,b={DEFAULT:_=>{const k=[x(_,!1)+32,_.col+32,_.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${g(k[0])}${g(k[1])}${g(k[2])}`},SGR:_=>{const k=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${x(_,!0)};${_.col};${_.row}${k}`},SGR_PIXELS:_=>{const k=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${x(_,!0)};${_.x};${_.y}${k}`}};let p=l.CoreMouseService=class extends w.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 A of Object.keys(R))this.addProtocol(A,R[A]);for(const A of Object.keys(b))this.addEncoding(A,b[A]);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,A){if(A){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=p=m([y(0,v.IBufferService),y(1,v.ICoreService)],p)},6975:function(f,l,d){var m=this&&this.__decorate||function(p,_,k,A){var C,N=arguments.length,j=N<3?_:A===null?A=Object.getOwnPropertyDescriptor(_,k):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(p,_,k,A);else for(var M=p.length-1;M>=0;M--)(C=p[M])&&(j=(N<3?C(j):N>3?C(_,k,j):C(_,k))||j);return N>3&&j&&Object.defineProperty(_,k,j),j},y=this&&this.__param||function(p,_){return function(k,A){_(k,A,p)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const v=d(1439),S=d(8460),w=d(844),R=d(2585),x=Object.freeze({insertMode:!1}),g=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let b=l.CoreService=class extends w.Disposable{constructor(p,_,k){super(),this._bufferService=p,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,v.clone)(x),this.decPrivateModes=(0,v.clone)(g)}reset(){this.modes=(0,v.clone)(x),this.decPrivateModes=(0,v.clone)(g)}triggerDataEvent(p,_=!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 "${p}"`,(()=>p.split("").map((A=>A.charCodeAt(0))))),this._onData.fire(p)}triggerBinaryEvent(p){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${p}"`,(()=>p.split("").map((_=>_.charCodeAt(0))))),this._onBinary.fire(p))}};l.CoreService=b=m([y(0,R.IBufferService),y(1,R.ILogService),y(2,R.IOptionsService)],b)},9074:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DecorationService=void 0;const m=d(8055),y=d(8460),v=d(844),S=d(6106);let w=0,R=0;class x extends v.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new S.SortedList((p=>p==null?void 0:p.marker.line)),this._onDecorationRegistered=this.register(new y.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new y.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,v.toDisposable)((()=>this.reset())))}registerDecoration(p){if(p.marker.isDisposed)return;const _=new g(p);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 p of this._decorations.values())p.dispose();this._decorations.clear()}*getDecorationsAtCell(p,_,k){let A=0,C=0;for(const N of this._decorations.getKeyIterator(_))A=N.options.x??0,C=A+(N.options.width??1),p>=A&&p<C&&(!k||(N.options.layer??"bottom")===k)&&(yield N)}forEachDecorationAtCell(p,_,k,A){this._decorations.forEachByKey(_,(C=>{w=C.options.x??0,R=w+(C.options.width??1),p>=w&&p<R&&(!k||(C.options.layer??"bottom")===k)&&A(C)}))}}l.DecorationService=x;class g extends v.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(p){super(),this.options=p,this.onRenderEmitter=this.register(new y.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new y.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=p.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.InstantiationService=l.ServiceCollection=void 0;const m=d(2585),y=d(8343);class v{constructor(...w){this._entries=new Map;for(const[R,x]of w)this.set(R,x)}set(w,R){const x=this._entries.get(w);return this._entries.set(w,R),x}forEach(w){for(const[R,x]of this._entries.entries())w(R,x)}has(w){return this._entries.has(w)}get(w){return this._entries.get(w)}}l.ServiceCollection=v,l.InstantiationService=class{constructor(){this._services=new v,this._services.set(m.IInstantiationService,this)}setService(S,w){this._services.set(S,w)}getService(S){return this._services.get(S)}createInstance(S,...w){const R=(0,y.getServiceDependencies)(S).sort(((b,p)=>b.index-p.index)),x=[];for(const b of R){const p=this._services.get(b.id);if(!p)throw new Error(`[createInstance] ${S.name} depends on UNKNOWN service ${b.id}.`);x.push(p)}const g=R.length>0?R[0].index:w.length;if(w.length!==g)throw new Error(`[createInstance] First service dependency of ${S.name} at position ${g+1} conflicts with ${w.length} static arguments`);return new S(...w,...x)}}},7866:function(f,l,d){var m=this&&this.__decorate||function(g,b,p,_){var k,A=arguments.length,C=A<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,p):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(g,b,p,_);else for(var N=g.length-1;N>=0;N--)(k=g[N])&&(C=(A<3?k(C):A>3?k(b,p,C):k(b,p))||C);return A>3&&C&&Object.defineProperty(b,p,C),C},y=this&&this.__param||function(g,b){return function(p,_){b(p,_,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.traceCall=l.setTraceLogger=l.LogService=void 0;const v=d(844),S=d(2585),w={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 R,x=l.LogService=class extends v.Disposable{get logLevel(){return this._logLevel}constructor(g){super(),this._optionsService=g,this._logLevel=S.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),R=this}_updateLogLevel(){this._logLevel=w[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(g){for(let b=0;b<g.length;b++)typeof g[b]=="function"&&(g[b]=g[b]())}_log(g,b,p){this._evalLazyOptionalParams(p),g.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+b,...p)}trace(g,...b){var p;this._logLevel<=S.LogLevelEnum.TRACE&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.trace.bind(this._optionsService.options.logger))??console.log,g,b)}debug(g,...b){var p;this._logLevel<=S.LogLevelEnum.DEBUG&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.debug.bind(this._optionsService.options.logger))??console.log,g,b)}info(g,...b){var p;this._logLevel<=S.LogLevelEnum.INFO&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.info.bind(this._optionsService.options.logger))??console.info,g,b)}warn(g,...b){var p;this._logLevel<=S.LogLevelEnum.WARN&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.warn.bind(this._optionsService.options.logger))??console.warn,g,b)}error(g,...b){var p;this._logLevel<=S.LogLevelEnum.ERROR&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.error.bind(this._optionsService.options.logger))??console.error,g,b)}};l.LogService=x=m([y(0,S.IOptionsService)],x),l.setTraceLogger=function(g){R=g},l.traceCall=function(g,b,p){if(typeof p.value!="function")throw new Error("not supported");const _=p.value;p.value=function(...k){if(R.logLevel!==S.LogLevelEnum.TRACE)return _.apply(this,k);R.trace(`GlyphRenderer#${_.name}(${k.map((C=>JSON.stringify(C))).join(", ")})`);const A=_.apply(this,k);return R.trace(`GlyphRenderer#${_.name} return`,A),A}}},7302:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionsService=l.DEFAULT_OPTIONS=void 0;const m=d(8460),y=d(844),v=d(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:v.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 w extends y.Disposable{constructor(x){super(),this._onOptionChange=this.register(new m.EventEmitter),this.onOptionChange=this._onOptionChange.event;const g={...l.DEFAULT_OPTIONS};for(const b in x)if(b in g)try{const p=x[b];g[b]=this._sanitizeAndValidateOption(b,p)}catch(p){console.error(p)}this.rawOptions=g,this.options={...g},this._setupOptions(),this.register((0,y.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(x,g){return this.onOptionChange((b=>{b===x&&g(this.rawOptions[x])}))}onMultipleOptionChange(x,g){return this.onOptionChange((b=>{x.indexOf(b)!==-1&&g()}))}_setupOptions(){const x=b=>{if(!(b in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);return this.rawOptions[b]},g=(b,p)=>{if(!(b in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);p=this._sanitizeAndValidateOption(b,p),this.rawOptions[b]!==p&&(this.rawOptions[b]=p,this._onOptionChange.fire(b))};for(const b in this.rawOptions){const p={get:x.bind(this,b),set:g.bind(this,b)};Object.defineProperty(this.options,b,p)}}_sanitizeAndValidateOption(x,g){switch(x){case"cursorStyle":if(g||(g=l.DEFAULT_OPTIONS[x]),!(function(b){return b==="block"||b==="underline"||b==="bar"})(g))throw new Error(`"${g}" is not a valid value for ${x}`);break;case"wordSeparator":g||(g=l.DEFAULT_OPTIONS[x]);break;case"fontWeight":case"fontWeightBold":if(typeof g=="number"&&1<=g&&g<=1e3)break;g=S.includes(g)?g:l.DEFAULT_OPTIONS[x];break;case"cursorWidth":g=Math.floor(g);case"lineHeight":case"tabStopWidth":if(g<1)throw new Error(`${x} cannot be less than 1, value: ${g}`);break;case"minimumContrastRatio":g=Math.max(1,Math.min(21,Math.round(10*g)/10));break;case"scrollback":if((g=Math.min(g,4294967295))<0)throw new Error(`${x} cannot be less than 0, value: ${g}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(g<=0)throw new Error(`${x} cannot be less than or equal to 0, value: ${g}`);break;case"rows":case"cols":if(!g&&g!==0)throw new Error(`${x} must be numeric, value: ${g}`);break;case"windowsPty":g=g??{}}return g}}l.OptionsService=w},2660:function(f,l,d){var m=this&&this.__decorate||function(w,R,x,g){var b,p=arguments.length,_=p<3?R:g===null?g=Object.getOwnPropertyDescriptor(R,x):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(w,R,x,g);else for(var k=w.length-1;k>=0;k--)(b=w[k])&&(_=(p<3?b(_):p>3?b(R,x,_):b(R,x))||_);return p>3&&_&&Object.defineProperty(R,x,_),_},y=this&&this.__param||function(w,R){return function(x,g){R(x,g,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkService=void 0;const v=d(2585);let S=l.OscLinkService=class{constructor(w){this._bufferService=w,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(w){const R=this._bufferService.buffer;if(w.id===void 0){const k=R.addMarker(R.ybase+R.y),A={data:w,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(A,k))),this._dataByLinkId.set(A.id,A),A.id}const x=w,g=this._getEntryIdKey(x),b=this._entriesWithId.get(g);if(b)return this.addLineToLink(b.id,R.ybase+R.y),b.id;const p=R.addMarker(R.ybase+R.y),_={id:this._nextId++,key:this._getEntryIdKey(x),data:x,lines:[p]};return p.onDispose((()=>this._removeMarkerFromLink(_,p))),this._entriesWithId.set(_.key,_),this._dataByLinkId.set(_.id,_),_.id}addLineToLink(w,R){const x=this._dataByLinkId.get(w);if(x&&x.lines.every((g=>g.line!==R))){const g=this._bufferService.buffer.addMarker(R);x.lines.push(g),g.onDispose((()=>this._removeMarkerFromLink(x,g)))}}getLinkData(w){var R;return(R=this._dataByLinkId.get(w))==null?void 0:R.data}_getEntryIdKey(w){return`${w.id};;${w.uri}`}_removeMarkerFromLink(w,R){const x=w.lines.indexOf(R);x!==-1&&(w.lines.splice(x,1),w.lines.length===0&&(w.data.id!==void 0&&this._entriesWithId.delete(w.key),this._dataByLinkId.delete(w.id)))}};l.OscLinkService=S=m([y(0,v.IBufferService)],S)},8343:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const d="di$target",m="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(y){return y[m]||[]},l.createDecorator=function(y){if(l.serviceRegistry.has(y))return l.serviceRegistry.get(y);const v=function(S,w,R){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(x,g,b){g[d]===g?g[m].push({id:x,index:b}):(g[m]=[{id:x,index:b}],g[d]=g)})(v,S,R)};return v.toString=()=>y,l.serviceRegistry.set(y,v),v}},2585:(f,l,d)=>{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=d(8343);var y;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(v){v[v.TRACE=0]="TRACE",v[v.DEBUG=1]="DEBUG",v[v.INFO=2]="INFO",v[v.WARN=3]="WARN",v[v.ERROR=4]="ERROR",v[v.OFF=5]="OFF"})(y||(l.LogLevelEnum=y={})),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:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const m=d(8460),y=d(225);class v{static extractShouldJoin(w){return(1&w)!=0}static extractWidth(w){return w>>1&3}static extractCharKind(w){return w>>3}static createPropertyValue(w,R,x=!1){return(16777215&w)<<3|(3&R)<<1|(x?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new m.EventEmitter,this.onChange=this._onChange.event;const w=new y.UnicodeV6;this.register(w),this._active=w.version,this._activeProvider=w}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(w){if(!this._providers[w])throw new Error(`unknown Unicode version "${w}"`);this._active=w,this._activeProvider=this._providers[w],this._onChange.fire(w)}register(w){this._providers[w.version]=w}wcwidth(w){return this._activeProvider.wcwidth(w)}getStringCellWidth(w){let R=0,x=0;const g=w.length;for(let b=0;b<g;++b){let p=w.charCodeAt(b);if(55296<=p&&p<=56319){if(++b>=g)return R+this.wcwidth(p);const A=w.charCodeAt(b);56320<=A&&A<=57343?p=1024*(p-55296)+A-56320+65536:R+=this.wcwidth(A)}const _=this.charProperties(p,x);let k=v.extractWidth(_);v.extractShouldJoin(_)&&(k-=v.extractWidth(x)),R+=k,x=_}return R}charProperties(w,R){return this._activeProvider.charProperties(w,R)}}l.UnicodeService=v}},r={};function o(f){var l=r[f];if(l!==void 0)return l.exports;var d=r[f]={exports:{}};return i[f].call(d.exports,d,d.exports,o),d.exports}var c={};return(()=>{var f=c;Object.defineProperty(f,"__esModule",{value:!0}),f.Terminal=void 0;const l=o(9042),d=o(3236),m=o(844),y=o(5741),v=o(8285),S=o(7975),w=o(7090),R=["cols","rows"];class x extends m.Disposable{constructor(b){super(),this._core=this.register(new d.Terminal(b)),this._addonManager=this.register(new y.AddonManager),this._publicOptions={...this._core.options};const p=k=>this._core.options[k],_=(k,A)=>{this._checkReadonlyOptions(k),this._core.options[k]=A};for(const k in this._core.options){const A={get:p.bind(this,k),set:_.bind(this,k)};Object.defineProperty(this._publicOptions,k,A)}}_checkReadonlyOptions(b){if(R.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 w.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 v.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const b=this._core.coreService.decPrivateModes;let p="none";switch(this._core.coreMouseService.activeProtocol){case"X10":p="x10";break;case"VT200":p="vt200";break;case"DRAG":p="drag";break;case"ANY":p="any"}return{applicationCursorKeysMode:b.applicationCursorKeys,applicationKeypadMode:b.applicationKeypad,bracketedPasteMode:b.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:p,originMode:b.origin,reverseWraparoundMode:b.reverseWraparound,sendFocusMode:b.sendFocus,wraparoundMode:b.wraparound}}get options(){return this._publicOptions}set options(b){for(const p in b)this._publicOptions[p]=b[p]}blur(){this._core.blur()}focus(){this._core.focus()}input(b,p=!0){this._core.input(b,p)}resize(b,p){this._verifyIntegers(b,p),this._core.resize(b,p)}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,p,_){this._verifyIntegers(b,p,_),this._core.select(b,p,_)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(b,p){this._verifyIntegers(b,p),this._core.selectLines(b,p)}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,p){this._core.write(b,p)}writeln(b,p){this._core.write(b),this._core.write(`\r
486
+ `,p)}paste(b){this._core.paste(b)}refresh(b,p){this._verifyIntegers(b,p),this._core.refresh(b,p)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return l}_verifyIntegers(...b){for(const p of b)if(p===1/0||isNaN(p)||p%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const p of b)if(p&&(p===1/0||isNaN(p)||p%1!=0||p<0))throw new Error("This API only accepts positive integers")}}f.Terminal=x})(),c})()))})(Om)),Om.exports}var WO=VO(),$m={exports:{}},jw;function GO(){return jw||(jw=1,(function(e,t){(function(i,r){e.exports=r()})(self,(()=>(()=>{var i={};return(()=>{var r=i;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 f=this._terminal.options.scrollback===0?0:o.viewport.scrollBarWidth,l=window.getComputedStyle(this._terminal.element.parentElement),d=parseInt(l.getPropertyValue("height")),m=Math.max(0,parseInt(l.getPropertyValue("width"))),y=window.getComputedStyle(this._terminal.element),v=d-(parseInt(y.getPropertyValue("padding-top"))+parseInt(y.getPropertyValue("padding-bottom"))),S=m-(parseInt(y.getPropertyValue("padding-right"))+parseInt(y.getPropertyValue("padding-left")))-f;return{cols:Math.max(2,Math.floor(S/c.css.cell.width)),rows:Math.max(1,Math.floor(v/c.css.cell.height))}}}})(),i})()))})($m)),$m.exports}var KO=GO(),Lm={exports:{}},Rw;function YO(){return Rw||(Rw=1,(function(e,t){(function(i,r){e.exports=r()})(self,(()=>(()=>{var i={6:(f,l)=>{function d(y){try{const v=new URL(y),S=v.password&&v.username?`${v.protocol}//${v.username}:${v.password}@${v.host}`:v.username?`${v.protocol}//${v.username}@${v.host}`:`${v.protocol}//${v.host}`;return y.toLocaleLowerCase().startsWith(S.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(l,"__esModule",{value:!0}),l.LinkComputer=l.WebLinkProvider=void 0,l.WebLinkProvider=class{constructor(y,v,S,w={}){this._terminal=y,this._regex=v,this._handler=S,this._options=w}provideLinks(y,v){const S=m.computeLink(y,this._regex,this._terminal,this._handler);v(this._addCallbacks(S))}_addCallbacks(y){return y.map((v=>(v.leave=this._options.leave,v.hover=(S,w)=>{if(this._options.hover){const{range:R}=v;this._options.hover(S,w,R)}},v)))}};class m{static computeLink(v,S,w,R){const x=new RegExp(S.source,(S.flags||"")+"g"),[g,b]=m._getWindowedLineStrings(v-1,w),p=g.join("");let _;const k=[];for(;_=x.exec(p);){const A=_[0];if(!d(A))continue;const[C,N]=m._mapStrIdx(w,b,0,_.index),[j,M]=m._mapStrIdx(w,C,N,A.length);if(C===-1||N===-1||j===-1||M===-1)continue;const O={start:{x:N+1,y:C+1},end:{x:M,y:j+1}};k.push({range:O,text:A,activate:R})}return k}static _getWindowedLineStrings(v,S){let w,R=v,x=v,g=0,b="";const p=[];if(w=S.buffer.active.getLine(v)){const _=w.translateToString(!0);if(w.isWrapped&&_[0]!==" "){for(g=0;(w=S.buffer.active.getLine(--R))&&g<2048&&(b=w.translateToString(!0),g+=b.length,p.push(b),w.isWrapped&&b.indexOf(" ")===-1););p.reverse()}for(p.push(_),g=0;(w=S.buffer.active.getLine(++x))&&w.isWrapped&&g<2048&&(b=w.translateToString(!0),g+=b.length,p.push(b),b.indexOf(" ")===-1););}return[p,R]}static _mapStrIdx(v,S,w,R){const x=v.buffer.active,g=x.getNullCell();let b=w;for(;R;){const p=x.getLine(S);if(!p)return[-1,-1];for(let _=b;_<p.length;++_){p.getCell(_,g);const k=g.getChars();if(g.getWidth()&&(R-=k.length||1,_===p.length-1&&k==="")){const A=x.getLine(S+1);A&&A.isWrapped&&(A.getCell(0,g),g.getWidth()===2&&(R+=1))}if(R<0)return[S,_]}S++,b=0}return[S,b]}}l.LinkComputer=m}},r={};function o(f){var l=r[f];if(l!==void 0)return l.exports;var d=r[f]={exports:{}};return i[f](d,d.exports,o),d.exports}var c={};return(()=>{var f=c;Object.defineProperty(f,"__esModule",{value:!0}),f.WebLinksAddon=void 0;const l=o(6),d=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function m(y,v){const S=window.open();if(S){try{S.opener=null}catch{}S.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}f.WebLinksAddon=class{constructor(y=m,v={}){this._handler=y,this._options=v}activate(y){this._terminal=y;const v=this._options,S=v.urlRegex||d;this._linkProvider=this._terminal.registerLinkProvider(new l.WebLinkProvider(this._terminal,S,this._handler,v))}dispose(){var y;(y=this._linkProvider)==null||y.dispose()}}})(),c})()))})(Lm)),Lm.exports}var XO=YO();const JO=/^[A-Za-z0-9_\-./~:\\]+$/,ZO=/^[A-Za-z]:[\\/]/;function R2(e){return JO.test(e)?e:ZO.test(e)?`"${e}"`:`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function QO(e){const t=e.filter(i=>i.length>0);return t.length===0?null:t.map(R2).join(" ")+" "}function e$(e,t){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal?session=${encodeURIComponent(e)}&token=${encodeURIComponent(t)}`}const t$=15e3,s$=new Set([4001,4004]),i$='"Geist Mono", ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace';function Vd(e,t){return typeof document>"u"?t:getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t}const n$={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"},r$={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 Tw(e){const t=Vd("--bg",e==="dark"?"#0b0e13":"#f8f9fa"),i=Vd("--ink",e==="dark"?"#f3f3f5":"#16161a"),r=Vd("--brand",e==="dark"?"#6be195":"#167e3a");return{...e==="dark"?n$:r$,background:t,foreground:i,cursor:r,cursorAccent:t,selectionBackground:`${r}40`}}const a$=({sessionId:e,token:t})=>{const i=z.useRef(null),r=z.useRef(null),[o,c]=z.useState("connecting"),[f,l]=z.useState(null);return z.useEffect(()=>Vv(d=>{r.current&&(r.current.options.theme=Tw(d))}),[]),z.useEffect(()=>{var A;const d=i.current;if(!d)return;let m=!1,y=0,v=null,S=null;const w=new WO.Terminal({cursorBlink:!0,fontSize:13,fontFamily:Vd("--mono",i$),theme:Tw(bh()),scrollback:1e4,allowProposedApi:!0});r.current=w;const R=new KO.FitAddon;w.loadAddon(R),w.loadAddon(new XO.WebLinksAddon((C,N)=>{window.open(N,"_blank","noopener,noreferrer")})),w.parser.registerCsiHandler({prefix:">",final:"q"},()=>(w.write("\x1BP>|XTerm(370)\x1B\\"),!0)),w.parser.registerOscHandler(52,C=>{var M;const N=C.split(";");if(N.length<2)return!1;const j=N[N.length-1];try{const O=atob(j),B=Uint8Array.from(O,V=>V.charCodeAt(0)),q=new TextDecoder().decode(B);(M=navigator.clipboard)==null||M.writeText(q).catch(()=>{})}catch{}return!0}),w.open(d),R.fit(),(A=document.fonts)==null||A.ready.then(()=>{m||(R.fit(),g())});const x=w.onData(C=>{(S==null?void 0:S.readyState)===WebSocket.OPEN&&S.send(C)}),g=()=>{(S==null?void 0:S.readyState)===WebSocket.OPEN&&S.send(JSON.stringify({type:"resize",cols:w.cols,rows:w.rows}))},b=new ResizeObserver(()=>{R.fit(),g()});b.observe(d);const p=C=>{var N;(N=C.dataTransfer)!=null&&N.types.includes("Files")&&(C.preventDefault(),C.dataTransfer.dropEffect="copy")},_=C=>{var O,B;const N=(O=C.dataTransfer)==null?void 0:O.files;if(!N||N.length===0)return;C.preventDefault();const j=(B=Xn())==null?void 0:B.pathForFile;if(!j)return;const M=QO(Array.from(N,q=>j(q)));M!==null&&(w.paste(M),w.focus())};d.addEventListener("dragover",p),d.addEventListener("drop",_);function k(){if(m)return;const C=new WebSocket(e$(e,t));S=C,C.onopen=()=>{y=0,c("connected"),l(null),R.fit(),g()},C.onmessage=N=>{const j=typeof N.data=="string"?N.data:new TextDecoder().decode(N.data);w.write(j)},C.onclose=N=>{if(m)return;if(s$.has(N.code)){c("error"),l(N.reason||`Connection refused (${N.code})`);return}const j=Math.min(1e3*2**y,t$);y+=1,c("connecting"),v=setTimeout(k,j)}}return k(),()=>{m=!0,v&&clearTimeout(v),d.removeEventListener("dragover",p),d.removeEventListener("drop",_),b.disconnect(),x.dispose(),S==null||S.close(),w.dispose(),r.current=null}},[e,t]),h.jsx("div",{className:"harness-terminal",...$t({surface:"terminal"}),children:h.jsx("div",{ref:i,className:"terminal-screen"})})},o$=8e3,l$=400,c$={info:"Info",success:"CircleCheck",error:"TriangleAlert"};function u$({message:e,tone:t="error",onDismiss:i}){const[r,o]=z.useState(!1),[c,f]=z.useState(!1),l=z.useCallback(()=>o(!0),[]);return z.useEffect(()=>{o(!1)},[e]),z.useEffect(()=>{if(r||c)return;const d=window.setTimeout(l,o$);return()=>window.clearTimeout(d)},[e,r,c,l]),z.useEffect(()=>{if(!r)return;const d=window.setTimeout(i,l$);return()=>window.clearTimeout(d)},[r,i]),h.jsxs("div",{className:r?"toast is-leaving":"toast",role:"alert","data-tone":t,"data-testid":"toast",onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),onFocus:()=>f(!0),onBlur:()=>f(!1),onAnimationEnd:r?i:void 0,children:[h.jsx("span",{className:"toast-icon","aria-hidden":"true",children:h.jsx(de,{name:c$[t],size:16})}),h.jsx("span",{className:"toast-message",children:e}),h.jsx("button",{className:"toast-dismiss","aria-label":"Dismiss",onClick:l,children:h.jsx(de,{name:"X",size:14})})]},e)}function d$(){const e=z.useRef(null);return z.useEffect(()=>{const t=e.current;if(!t)return;let i=null;const r=()=>{i=null,t.dataset.show="false",t.textContent=""},o=l=>{const d=l.closest("[data-tooltip], [title], [data-tip-stash]");if(!d||d===i)return;const m=d;m.title&&(m.dataset.tipStash=m.title,m.removeAttribute("title"));const y=m.dataset.tooltip||m.dataset.tipStash;if(!y)return;i=d,t.textContent=y,t.dataset.show="true";const v=d.getBoundingClientRect(),{offsetWidth:S,offsetHeight:w}=t,R=d.closest(".rail-workflows");if(R&&R.getBoundingClientRect().right+S+14<=window.innerWidth){const b=R.getBoundingClientRect().right+8,p=Math.min(Math.max(v.top+v.height/2-w/2,6),window.innerHeight-w-6);t.style.transform=`translate(${Math.round(b)}px, ${Math.round(p)}px)`;return}const x=Math.min(Math.max(v.left+v.width/2-S/2,6),window.innerWidth-S-6),g=v.top-w-7>=4?v.top-w-7:v.bottom+7;t.style.transform=`translate(${Math.round(x)}px, ${Math.round(g)}px)`},c=l=>o(l.target),f=l=>{i&&!i.contains(l.relatedTarget)&&r()};return document.addEventListener("pointerover",c,!0),document.addEventListener("pointerout",f,!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",f,!0),document.removeEventListener("pointerdown",r,!0),document.removeEventListener("keydown",r,!0),document.removeEventListener("scroll",r,!0),window.removeEventListener("blur",r)}},[]),h.jsx("div",{ref:e,className:"app-tooltip","data-show":"false",role:"tooltip","aria-hidden":"true"})}const h$="~/.sapiom/harness",f$={events:`${h$}/events.ndjson`},Rd=10*1024*1024,Pv=50*1024*1024,p$=["claude-code","codex"],wg=["vscode","vscode-insiders","cursor","windsurf","zed"],m$=[{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 v$(e){const t=e.filter(i=>i.id==="sapiom");return t.length===0?e:[...t,...e.filter(i=>i.id!=="sapiom")]}function xg(e){return e.mode==="embedded"&&e.installed&&p$.includes(e.id)}function g$(e){if(xg(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 _$(e,t){var i;return((i=e.find(r=>r.id===t))==null?void 0:i.label)??t}function y$(e){return e.name||"pasted-file"}function b$(e,t){const i=[];for(let o=0;o<e.length;o+=32768)i.push(String.fromCharCode(...e.subarray(o,o+32768)));return`data:${t};base64,${btoa(i.join(""))}`}async function S$(e){const t=new Uint8Array(e.byteLength);t.set(e);const i=await crypto.subtle.digest("SHA-256",t.buffer);return Array.from(new Uint8Array(i),r=>r.toString(16).padStart(2,"0")).join("")}async function w$(e,t,i=Pv){const r=[],o=[];let c=0;for(const f of e){const l=y$(f);let d="";try{d=(t==null?void 0:t(f))??""}catch{}if(d){r.push({id:crypto.randomUUID(),kind:"path",name:l,path:d});continue}if(f.size>Rd){o.push(`${l} is too large to paste (${f.size} bytes; limit ${Rd} bytes).`);continue}if(c+f.size>i){o.push(`${l} would exceed the ${Pv}-byte pasted-file limit for one session.`);continue}try{const m=f.type||"application/octet-stream",y=new Uint8Array(await f.arrayBuffer());if(y.byteLength>Rd){o.push(`${l} is too large to paste (${y.byteLength} bytes; limit ${Rd} bytes).`);continue}r.push({id:crypto.randomUUID(),kind:"inline",name:l,mediaType:m,bytes:y.byteLength,dataUrl:b$(y,m),fingerprint:await S$(y)}),c+=y.byteLength}catch{o.push(`Couldn't read ${l}.`)}}return{attachments:r,errors:o}}function Nw(e){return e.kind==="path"?`path:${e.path}`:`inline:${e.fingerprint}`}function x$(e,t){const i=new Set(e.map(Nw)),r=[...e];for(const o of t){const c=Nw(o);i.has(c)||(i.add(c),r.push(o))}return r}async function C$(e,t,i){const r=[];for(const o of t){if(o.kind==="path"){r.push({name:o.name,path:o.path});continue}try{const c=await i(e,{dataUrl:o.dataUrl,filename:o.name});r.push({name:o.name,path:c.path})}catch(c){const f=c.message;throw new Error(`Couldn't attach ${o.name}${f?`: ${f}`:"."}`,{cause:c})}}return r}function E$(e,t){const i=e.trim();if(t.length===0)return i||void 0;const o=`Attached files (read each as context):
487
+ ${t.map(c=>R2(c.path)).join(`
488
+ `)}`;return i?`${i}
489
+
490
+ ${o}`:o}function Im(e){return nc(e)}async function k$(e,t,i){const r=Im(e.trim());if(!r)return{kind:"new"};if(t)return{kind:"new"};const o=c5(r);try{const c=o?await i(o):null;if(!!(c!=null&&c.dirs.some(m=>Im(m.path)===r&&m.hasAgentProject)))return{kind:"project"};const l=await i(r);if(Im(l.path)!==r)return{kind:"new"};const d=l.dirs.filter(m=>m.hasAgentProject).length;return d>0?{kind:"multi",found:d}:{kind:"plain"}}catch{if(o)try{return await i(o),{kind:"new"}}catch{throw new Error("Couldn't read that directory.")}throw new Error("Couldn't read that directory.")}}function Cg({recentDirs:e,launchDir:t,projectRoot:i,listDir:r,onClose:o,onConnect:c,onScan:f,triggerRef:l}){const[d,m]=z.useState(i??t??e[0]??""),[y,v]=z.useState(null),[S,w]=z.useState(!0),[R,x]=z.useState(!1),[g,b]=z.useState(null),p=z.useRef(null);xo(!0,{onDismiss:o,containerRef:p,triggerRef:l}),z.useEffect(()=>{w(!0)},[d]);const _=z.useRef(d);_.current=d;const k=z.useRef(0),A=z.useCallback(V=>{const J=_.current.trim(),ee=++k.current;if(!J){v(null),w(!1);return}k$(J,V.isNew,r).then(W=>{ee===k.current&&(v(W),b(null))}).catch(W=>{ee===k.current&&(v(null),b(W.message))}).finally(()=>{ee===k.current&&w(!1)})},[r]),C=async V=>{x(!0),b(null);try{await V(),o()}catch(J){b(J.message)}finally{x(!1)}},N=d.trim(),j=(y==null?void 0:y.kind)==="project"||(y==null?void 0:y.kind)==="multi",M=()=>void C(()=>c(N)),O=()=>void C(async()=>{if(await f(N)===0)throw new Error("No agent projects found under this folder.")}),B=()=>{R||S||!y||!N||!j||(y.kind==="project"?M():y.kind==="multi"&&O())},q=V=>{V.key==="Enter"&&(V.metaKey||V.ctrlKey)&&(V.preventDefault(),B())};return h.jsx("div",{className:"modal-backdrop",children:h.jsxs("div",{className:"modal modal-start",role:"dialog","aria-label":"Add existing agents",ref:p,onKeyDown:q,...$t({dialog:"add_agents"}),children:[h.jsxs("div",{className:"modal-header modal-start-header",children:[h.jsx("span",{className:"modal-start-title",children:"Add existing agents"}),h.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:o,children:h.jsx(de,{name:"X",size:14})})]}),h.jsxs("div",{className:"modal-body",children:[h.jsx("p",{className:"modal-field-hint modal-start-sub",children:"Add a folder that already holds an agent project."}),h.jsx("section",{className:"modal-section",children:h.jsx(k2,{value:d,onChange:m,onSubmit:B,recentDirs:[],listDir:r,onResolve:A})}),y&&h.jsx(A$,{outcome:y,path:N}),g&&h.jsx("div",{className:"modal-error",children:g})]}),h.jsxs("div",{className:"modal-actions modal-start-actions",children:[h.jsx("button",{className:"btn-ghost",onClick:o,disabled:R,children:"Cancel"}),h.jsx(j$,{outcome:y,checking:S,busy:R,onConnect:M,onScan:O})]})]})})}function A$({outcome:e,path:t}){const i=e.kind==="project"||e.kind==="multi";return h.jsx("div",{className:"aw-result","data-tone":i?"good":"todo","data-testid":"aw-result","aria-live":"polite",children:h.jsxs("div",{className:"aw-result-head",children:[h.jsx("span",{className:"aw-result-glyph","aria-hidden":"true",children:h.jsx(de,{name:i?"Check":"TriangleAlert",size:14})}),h.jsxs("span",{className:"aw-result-text",children:[h.jsxs("span",{className:"aw-result-title",children:[e.kind==="project"&&"This is an agent project",e.kind==="multi"&&`${e.found} agent ${e.found===1?"project":"projects"} under this folder`,(e.kind==="plain"||e.kind==="new")&&"No agent in this folder"]}),h.jsx("span",{className:"aw-result-path",title:t,children:t})]})]})})}function j$({outcome:e,checking:t,busy:i,onConnect:r,onScan:o}){if(t||!e)return h.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"start-primary",disabled:!0,children:"Checking…"});switch(e.kind){case"project":return h.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-add",onClick:r,disabled:i,children:i?"Adding…":"Add workspace"});case"multi":return h.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-add-all",onClick:o,disabled:i,children:i?"Adding…":`Add all ${e.found}`});case"plain":case"new":return h.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"start-primary",disabled:!0,children:"Add workspace"})}}const R$="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",T$="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",N$={"claude-code":R$,codex:T$},M$=["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 Eg({kind:e,size:t=16}){if(e==="sapiom")return h.jsx("svg",{viewBox:"0 0 115 122",width:t,height:t,fill:"currentColor","aria-hidden":"true",focusable:"false",children:M$.map(r=>h.jsx("path",{d:r},r.slice(0,16)))});const i=N$[e];return i?h.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"currentColor","aria-hidden":"true",focusable:"false",children:h.jsx("path",{d:i})}):h.jsx(de,{name:"SquareTerminal",size:t})}function D$({entries:e,activeId:t,testidPrefix:i,onPick:r}){return h.jsx(h.Fragment,{children:e.map(o=>{const c=xg(o),f=o.id===t,l=g$(o);return h.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":f,"aria-disabled":!c||void 0,className:"profile-menu-item provider-item"+(c?"":" is-unavailable"),"data-testid":`${i}-${o.id}`,"data-tooltip":l??void 0,onClick:()=>{c&&r(o.id)},children:[h.jsx("span",{className:"provider-item-check","aria-hidden":"true",children:f&&h.jsx(de,{name:"Check",size:13})}),h.jsx(Eg,{kind:o.id,size:13}),o.label]},o.id)})})}const O$=[{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."}],$$=3;function L$(e){const t=e.getHours();return t<12?"Good morning.":t<18?"Good afternoon.":"Good evening."}function I$(e){return e.replace(/\s+/g,"-")}function P$({firstRun:e,onSubmitIdea:t,onAttachmentError:i,onUseTemplate:r,onBrowseTemplates:o,listHarnesses:c,listTemplates:f,telemetryOptIn:l,onToggleTelemetry:d,recentDirs:m,projectRoot:y,listDir:v,onConnect:S,onScan:w,onScaffold:R,onSaveProjectRoot:x}){const[g,b]=z.useState(""),[p,_]=z.useState(()=>dn().preferredHarness??"claude-code"),[k,A]=z.useState(m$),[C,N]=z.useState(!1),[j,M]=z.useState([]),[O,B]=z.useState(!1),[q,V]=z.useState([]),[J,ee]=z.useState(!1),[W,Q]=z.useState(!1),[ie,I]=z.useState(!1),[P,D]=z.useState(!1),H=z.useRef(null),U=z.useRef(null),L=z.useRef(null),G=z.useRef(null),se=z.useRef([]),Y=z.useRef(!1),F=z.useRef(!1),le=z.useRef(Promise.resolve()),ae=z.useRef(0),X=z.useCallback(()=>N(!1),[]);z.useEffect(()=>{let Ee=!1;return c().then(qe=>{if(Ee||qe.length===0)return;A(v$(qe));const We=qe.filter(xg);_(it=>{var Ze;return We.some(Je=>Je.id===it)?it:((Ze=We[0])==null?void 0:Ze.id)??it})}).catch(()=>{}),()=>{Ee=!0}},[c]),z.useEffect(()=>{let Ee=!1;return f().then(qe=>{Ee||M(qe.templates.map(We=>({...We,kind:"gallery"})).slice(0,$$))}).catch(()=>{}),()=>{Ee=!0}},[f]);const te=Ee=>{_(Ee),Kn({preferredHarness:Ee==="codex"?"codex":"claude-code"}),X()},ue=Ee=>{P||(D(!0),window.setTimeout(Ee,170))},me=()=>{if(P||Y.current||F.current)return;Y.current=!0,I(!0),D(!0);const Ee=se.current;window.setTimeout(()=>{t(g.trim(),p,Ee).catch(qe=>{var We;Y.current=!1,D(!1),I(!1),(We=H.current)==null||We.focus(),i(qe.message||"Couldn't start a session with those files.")})},170)},je=Ee=>{var Ze;if(Ee.length===0||Y.current)return;const qe=(Ze=Xn())==null?void 0:Ze.pathForFile;ae.current+=1,F.current=!0,Q(!0);const We=async()=>{const Je=se.current.reduce((mt,Qt)=>mt+(Qt.kind==="inline"?Qt.bytes:0),0),wt=await w$(Ee,qe,Math.max(0,Pv-Je));if(wt.attachments.length>0){const mt=x$(se.current,wt.attachments);se.current=mt,V(mt)}wt.errors.length>0&&i(wt.errors.join(" "))},it=le.current.then(We);le.current=it.catch(()=>{}),it.catch(Je=>{i(Je.message||"Couldn't attach those files.")}).then(()=>{ae.current-=1,ae.current===0&&(F.current=!1,Q(!1))})},Oe=Ee=>{if(Y.current)return;const qe=se.current.filter(We=>We.id!==Ee);se.current=qe,V(qe)},Le=q.length===0?"No files attached.":q.length===1?"1 file attached.":`${q.length} files attached.`,at=J?"Drop files to attach.":ie?`Starting session with ${Le.toLowerCase()}`:W?"Preparing attached files.":Le;return h.jsxs("div",{className:"composer-home"+(P?" is-leaving":""),"data-testid":"new-session-composer",...$t({surface:"composer"}),children:[h.jsxs("div",{className:"composer-hero",children:[h.jsxs("p",{className:"composer-greeting","data-testid":"composer-greeting",children:[L$(new Date)," ",e?"Let's build your first agent.":"Let's build a new agent."]}),h.jsx("h1",{className:"composer-heading",children:"What should your agent do?"}),h.jsx("div",{className:"composer-chips",role:"list",children:O$.map(Ee=>h.jsx("button",{type:"button",role:"listitem",className:"composer-chip","data-testid":`composer-chip-${I$(Ee.label)}`,onClick:()=>{var qe;b(Ee.prompt),(qe=H.current)==null||qe.focus()},children:Ee.label},Ee.label))}),h.jsxs("div",{className:"composer-box"+(J?" is-dragging-files":"")+(ie||W?" is-busy":""),"data-testid":"composer-box",role:"group","aria-label":"New session request","aria-busy":ie||W,"aria-describedby":"composer-attachment-status",onPaste:Ee=>{const qe=Array.from(Ee.clipboardData.items).filter(it=>it.kind==="file").flatMap(it=>{const Ze=it.getAsFile();return Ze?[Ze]:[]}),We=qe.length>0?qe:Array.from(Ee.clipboardData.files??[]);We.length!==0&&(Ee.preventDefault(),je(We))},onDragEnter:Ee=>{Array.from(Ee.dataTransfer.types).includes("Files")&&(Ee.preventDefault(),!Y.current&&ee(!0))},onDragOver:Ee=>{Array.from(Ee.dataTransfer.types).includes("Files")&&(Ee.preventDefault(),!Y.current&&(Ee.dataTransfer.dropEffect="copy",ee(!0)))},onDragLeave:Ee=>{const qe=Ee.relatedTarget;qe instanceof Node&&Ee.currentTarget.contains(qe)||ee(!1)},onDrop:Ee=>{Array.from(Ee.dataTransfer.types).includes("Files")&&(Ee.preventDefault(),ee(!1),je(Array.from(Ee.dataTransfer.files)))},children:[J&&h.jsxs("div",{className:"composer-drop-hint","aria-hidden":"true",children:[h.jsx(de,{name:"CloudUpload",size:18})," Drop files to attach"]}),h.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:g,rows:2,autoFocus:!0,onChange:Ee=>b(Ee.target.value),onKeyDown:Ee=>{Ee.key==="Enter"&&!Ee.shiftKey&&(Ee.preventDefault(),me())}}),q.length>0&&h.jsx("ul",{className:"composer-files","data-testid":"composer-files","aria-label":"Attached files",children:q.map(Ee=>h.jsxs("li",{className:"composer-file",...$t({object:"file"}),children:[h.jsx(de,{name:"Paperclip",size:13}),h.jsx("span",{className:"composer-file-name",title:Ee.name,children:Ee.name}),h.jsx("button",{type:"button",className:"composer-file-remove","aria-label":`Remove ${Ee.name}`,disabled:ie,onClick:()=>Oe(Ee.id),children:h.jsx(de,{name:"X",size:11})})]},Ee.id))}),h.jsxs("div",{className:"composer-box-actions",children:[h.jsx("button",{ref:G,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:()=>B(!0),children:h.jsx(de,{name:"Plus",size:16})}),h.jsx("button",{type:"button",className:"composer-attach","data-testid":"composer-attach-files","aria-label":"Attach files","data-tooltip":"Attach files",disabled:ie,onClick:()=>{var Ee;return(Ee=U.current)==null?void 0:Ee.click()},children:h.jsx(de,{name:"Paperclip",size:15})}),h.jsx("input",{ref:U,type:"file",multiple:!0,hidden:!0,"data-testid":"composer-file-input",onChange:Ee=>{je(Ee.target.files?Array.from(Ee.target.files):[]),Ee.target.value=""}}),h.jsxs("div",{className:"composer-box-right",children:[h.jsxs("button",{ref:L,type:"button",className:"harness-select composer-harness","data-testid":"composer-harness-select","aria-haspopup":"menu","aria-expanded":C,"aria-label":"Coding agent for this session","data-tooltip":"Which coding agent runs this session",onClick:()=>N(Ee=>!Ee),children:[h.jsx(Eg,{kind:p,size:14}),h.jsx("span",{className:"harness-select-label",children:_$(k,p)}),h.jsx("span",{className:"disclosure-caret"+(C?" is-open":""),"aria-hidden":"true",children:h.jsx(de,{name:"ChevronDown",size:12})})]}),h.jsx(fn,{open:C,anchorRef:L,onDismiss:X,placement:"up-end",className:"session-menu harness-select-menu",role:"menu",testid:"composer-harness-menu",children:h.jsx(D$,{entries:k,activeId:p,testidPrefix:"composer-harness-option",onPick:te})}),h.jsx("button",{type:"button",className:"composer-send","data-testid":"composer-send","aria-label":"Start session",title:"Start session",disabled:ie||W,onClick:me,children:h.jsx(de,{name:"ArrowUp",size:16})})]})]})]}),h.jsx("div",{id:"composer-attachment-status",className:"visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":"composer-attachment-status",children:at})]}),j.length>0&&h.jsxs("div",{className:"composer-templates",children:[h.jsxs("div",{className:"composer-templates-head",children:[h.jsx("span",{className:"composer-templates-title",children:"Start from a template"}),h.jsxs("button",{type:"button",className:"composer-templates-all","data-testid":"composer-browse-templates",onClick:o,children:["Browse all templates ",h.jsx(de,{name:"ChevronRight",size:13})]})]}),h.jsx("div",{className:"composer-template-grid",children:j.map((Ee,qe)=>h.jsxs("button",{type:"button",className:"composer-template-card","data-testid":`composer-template-${Ee.id}`,onClick:()=>ue(()=>r(Ee)),children:[h.jsxs("span",{className:"composer-template-cardhead",children:[h.jsx("span",{className:"composer-template-name",children:Ee.name}),qe===0&&h.jsx("span",{className:"composer-template-suggested",children:"Suggested"})]}),h.jsx("span",{className:"composer-template-desc",children:Ee.description}),h.jsxs("span",{className:"composer-template-meta",children:[Ee.stepCount," ",Ee.stepCount===1?"step":"steps"," ·"," ",gg(Ee.complexity),Ee.capabilities.length>0&&` · ${Ee.capabilities.length} ${Ee.capabilities.length===1?"capability":"capabilities"}`]})]},Ee.id))})]}),e&&h.jsxs("div",{className:"composer-footer",children:[h.jsxs("label",{className:"composer-consent","data-testid":"welcome-consent",children:[h.jsx("button",{type:"button",role:"switch","aria-checked":l,"data-testid":"welcome-telemetry-toggle",className:"toggle-switch"+(l?" is-on":""),onClick:()=>void d(!l),children:h.jsx("span",{className:"toggle-knob"})}),h.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."})]}),h.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 ",h.jsx(de,{name:"ArrowUpRight",size:12})]})]}),O&&h.jsx(Cg,{recentDirs:m,projectRoot:y,listDir:v,onClose:()=>B(!1),onConnect:S,onScan:w,triggerRef:G})]})}function B$({firstRun:e,appVersion:t,recentDirs:i,projectRoot:r,listDir:o,onConnect:c,onScan:f,onBrowseTemplates:l,onDismiss:d}){const[m,y]=z.useState(!1),v=z.useRef(null),S=z.useRef(d);return S.current=d,z.useEffect(()=>{if(m)return;const w=x=>{x.key==="Escape"&&S.current()},R=window.setTimeout(()=>window.addEventListener("keydown",w),0);return()=>{window.clearTimeout(R),window.removeEventListener("keydown",w)}},[m]),h.jsxs("div",{className:"overview-modal","data-testid":"overview-modal",role:"dialog","aria-modal":"true","aria-label":"Sapiom agent.studio overview",onClick:w=>{w.target===w.currentTarget&&d()},children:[h.jsxs("div",{className:"overview-modal-card",children:[h.jsx("button",{type:"button",className:"theme-toggle overview-modal-close","data-testid":"overview-exit","aria-label":"Close","data-tooltip":"Close",onClick:d,children:h.jsx(de,{name:"X",size:14})}),h.jsxs("div",{className:"overview-modal-body",children:[h.jsx("h1",{className:"overview-modal-title",children:e?"Welcome to Sapiom agent.studio":"Sapiom agent.studio"}),t&&h.jsxs("p",{className:"overview-modal-version","data-testid":"overview-version",children:["v",t]}),h.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."}),h.jsxs("div",{className:"overview-modal-path","data-testid":"overview-open-card",children:[h.jsx("span",{className:"overview-modal-path-icon","aria-hidden":"true",children:h.jsx(de,{name:"FolderOpen",size:20})}),h.jsxs("span",{className:"overview-modal-path-copy",children:[h.jsx("span",{className:"overview-modal-path-title",children:"Open a folder"}),h.jsx("span",{className:"overview-modal-path-desc",children:"Agents in the folder appear in the rail. Nothing is uploaded."})]}),h.jsx("button",{ref:v,type:"button",className:"btn-primary overview-modal-cta","data-testid":"overview-open-folder",onClick:()=>y(!0),children:"Open folder"})]}),h.jsxs("div",{className:"overview-modal-path","data-testid":"overview-templates-card",children:[h.jsx("span",{className:"overview-modal-path-icon","aria-hidden":"true",children:h.jsx(de,{name:"LayoutTemplate",size:20})}),h.jsxs("span",{className:"overview-modal-path-copy",children:[h.jsx("span",{className:"overview-modal-path-title",children:"Start from a template"}),h.jsx("span",{className:"overview-modal-path-desc",children:"Runnable starters, cloned locally and free to test."})]}),h.jsx("button",{type:"button",className:"btn-line overview-modal-cta","data-testid":"overview-browse-templates",onClick:l,children:"Browse templates"})]}),h.jsxs("a",{className:"overview-modal-docs","data-testid":"overview-docs",href:xA,target:"_blank",rel:"noopener noreferrer",children:["Read documentation ",h.jsx(de,{name:"ArrowUpRight",size:12})]})]})]}),m&&h.jsx(Cg,{recentDirs:i,projectRoot:r,listDir:o,onClose:()=>y(!1),onConnect:c,onScan:f,triggerRef:v})]})}const H$="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",Mw=89,yh=24,z$=19.9385,U$=(yh-z$)/yh;function q$({height:e=16,className:t,style:i,...r}){const o=!!r["aria-label"];return h.jsx("svg",{...r,className:["brand-logotype",t].filter(Boolean).join(" "),style:{"--brand-logotype-descender":`${U$*e}px`,...i},width:Mw/yh*e,height:e,viewBox:`0 0 ${Mw} ${yh}`,fill:"none",focusable:"false",role:o?"img":void 0,"aria-hidden":o?void 0:!0,children:h.jsx("path",{d:H$,fill:"currentColor"})})}function F$({canGoBack:e,canGoForward:t,onGoBack:i,onGoForward:r}){return h.jsxs("div",{className:"session-nav","data-testid":"session-nav",role:"group","aria-label":"Go back or forward",children:[h.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:i,children:h.jsx(de,{name:"ArrowLeft",size:14})}),h.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:h.jsx(de,{name:"ArrowRight",size:14})})]})}function V$({onCollapse:e,canGoBack:t,canGoForward:i,onGoBack:r,onGoForward:o}){return h.jsxs("header",{className:"brand-header",children:[h.jsx("div",{className:"brand-header-window",children:h.jsx("button",{className:"theme-toggle rail-toggle","data-testid":"rail-collapse","aria-label":"Collapse workspace panel",title:"Collapse workspace panel",onClick:e,children:h.jsx(de,{name:"PanelLeftClose",size:14})})}),h.jsxs("h1",{className:"brand-lockup",children:[h.jsxs("span",{className:"brand-mark",children:[h.jsx(q$,{height:13,"aria-hidden":!0}),h.jsx("span",{className:"visually-hidden",children:"Sapiom "})]}),h.jsx("span",{className:"brand-product",children:"agent.studio"})]}),h.jsx(F$,{canGoBack:t,canGoForward:i,onGoBack:r,onGoForward:o})]})}function Pm(e){const t=Math.round(e*100)/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function W$(e){switch(e.kind){case"limit":return`${Pm(e.usedUsd)} / ${Pm(e.limitUsd)}`;case"balance":return`${Pm(e.availableUsd)} available`;case"none":return null}}function G$({plan:e}){const[t,i]=z.useState(!1),r=z.useRef(null),o=z.useCallback(()=>i(!1),[]);if(!e)return null;const c=W$(e.readout);return!e.plan&&!c?null:h.jsx("div",{className:"rail-footer-row plan-row","data-testid":"plan-card",children:h.jsxs("div",{className:"rail-footer-card plan-card",children:[h.jsxs("span",{className:"plan-card-copy",children:[e.plan&&h.jsx("span",{className:"plan-card-name",children:e.plan.name}),c&&h.jsx("span",{className:"plan-card-readout","data-testid":"plan-balance",children:c})]}),h.jsx("a",{className:"pill plan-card-upgrade",href:_b,target:"_blank",rel:"noreferrer","data-testid":"plan-upgrade",onClick:()=>rc("plan.upgrade_clicked"),children:"Upgrade"}),h.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:()=>i(f=>!f),children:h.jsx(de,{name:"MoreVertical",size:13})}),h.jsxs(fn,{open:t,anchorRef:r,onDismiss:o,placement:"up-end",className:"plan-menu",role:"menu",testid:"plan-menu",children:[h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"plan-manage-billing",onClick:()=>{window.open(_b,"_blank","noopener,noreferrer"),o()},children:[h.jsx(de,{name:"ExternalLink",size:13}),"Manage billing"]}),h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"plan-view-usage",onClick:()=>{window.open(SA,"_blank","noopener,noreferrer"),o()},children:[h.jsx(de,{name:"ExternalLink",size:13}),"View usage"]})]})]})})}function K$({desktop:e,version:t,onToast:i}){const[r,o]=z.useState(!1),c=async()=>{if(!r){o(!0);try{const f=await e.checkForUpdates();f.kind!=="downloaded"&&i(E2(f).text)}catch{i("Couldn't check for updates.")}finally{o(!1)}}};return h.jsx("div",{className:"rail-footer-row update-row",children:h.jsxs("button",{className:"rail-footer-card update-card","data-testid":"update-card",disabled:r,onClick:()=>void c(),children:[h.jsx("span",{className:"update-card-label",children:"Update now"}),h.jsxs("span",{className:"update-card-version","data-testid":"update-card-version",children:["v",t]}),h.jsx(de,{name:"ChevronRight",size:14})]})})}function Td({testid:e,icon:t,label:i,checked:r,onPick:o}){return h.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":r,"data-testid":e,className:"session-dropdown-item menu-choice"+(r?" is-checked":""),onClick:o,children:[h.jsx("span",{className:"session-item-icon",children:h.jsx(de,{name:t,size:13})}),h.jsx("span",{className:"session-item-copy",children:h.jsx("span",{className:"session-item-title",children:i})}),h.jsx("span",{className:"menu-choice-mark","aria-hidden":"true",children:r&&h.jsx(de,{name:"Check",size:13})})]})}const Y$=wg[0],T2={vscode:"VS Code","vscode-insiders":"VS Code Insiders",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"},X$=wg.map(e=>({kind:e,label:T2[e]}));function $h(e){return wg.includes(e)?e:Y$}function Dw(e){return T2[$h(e)]}function J$(e,t){const i=t.replace(/\\/g,"/"),r=i.startsWith("/")?i:`/${i}`;return`${$h(e)}://file${encodeURI(r)}`}function Z$({authenticated:e,organizationName:t,telemetryOptIn:i,productAnalyticsOptIn:r,consentSource:o,consentEnvReason:c,onToggleTelemetry:f,onToggleProductAnalytics:l,rollingSummary:d,onToggleRollingSummary:m,editor:y,onSelectEditor:v,onStartAuth:S,onDisconnect:w}){const[R,x]=z.useState(!1),[g,b]=z.useState({status:"idle"}),p=o==="env-forced-off",_=p?!1:i,k=p?!1:r,A=async()=>{const O=!i;x(!0);try{await f(O),rc("consent.changed",{optIn:O})}finally{x(!1)}},C=async()=>{const O=!r;x(!0);try{await l(O),rc("consent.changed",{productAnalytics:O})}finally{x(!1)}},N=async()=>{x(!0);try{await m(!d)}finally{x(!1)}},j=async O=>{x(!0);try{await v(O)}finally{x(!1)}},M=async()=>{b({status:"pending"});try{await S()}catch(O){const B=O instanceof Error?O.message:"Could not start sign-in. Try again.";b({status:"error",message:B})}};return e&&g.status==="pending"&&b({status:"idle"}),h.jsxs(A2,{surface:"settings",children:[h.jsx("div",{className:"settings-identity",children:e?t??"Signed in":"Not signed in"}),!e&&h.jsx("div",{className:"settings-auth-row",children:g.status==="pending"?h.jsxs("span",{className:"settings-auth-pending","data-testid":"settings-auth-pending",children:[h.jsx(de,{name:"Loader",size:13}),"Opening browser… waiting for sign-in"]}):h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",className:"btn-primary settings-connect-btn","data-testid":"settings-connect-btn",onClick:()=>void M(),children:"Connect account"}),g.status==="error"&&h.jsx("p",{className:"settings-note settings-auth-error","data-testid":"settings-auth-error",children:g.message})]})}),Wv(),h.jsxs("label",{className:"settings-toggle-row",children:[h.jsx("span",{children:"Share session details with Sapiom"}),h.jsx("button",{type:"button",role:"switch","aria-checked":_,"data-testid":"telemetry-toggle",className:"toggle-switch"+(_?" is-on":""),disabled:R||p,onClick:()=>void A(),children:h.jsx("span",{className:"toggle-knob"})})]}),h.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 ",h.jsx("code",{children:f$.events})," either way."]}),h.jsxs("label",{className:"settings-toggle-row",children:[h.jsx("span",{children:"Product analytics (clicks & usage)"}),h.jsx("button",{type:"button",role:"switch","aria-checked":k,"data-testid":"product-analytics-toggle",className:"toggle-switch"+(k?" is-on":""),disabled:R||p,onClick:()=>void C(),children:h.jsx("span",{className:"toggle-knob"})})]}),h.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."}),p&&h.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."]}),h.jsxs("label",{className:"settings-toggle-row",children:[h.jsx("span",{children:"Summarize sessions in the background"}),h.jsx("button",{type:"button",role:"switch","aria-checked":d,"data-testid":"rolling-summary-toggle",className:"toggle-switch"+(d?" is-on":""),disabled:R,onClick:()=>void N(),children:h.jsx("span",{className:"toggle-knob"})})]}),h.jsxs("label",{className:"settings-toggle-row",children:[h.jsx("span",{children:"Open in editor uses"}),h.jsxs("span",{className:"settings-select-wrap",children:[h.jsx("select",{className:"settings-select","data-testid":"editor-select",value:$h(y),disabled:R,onChange:O=>void j(O.target.value),children:X$.map(O=>h.jsx("option",{value:O.kind,children:O.label},O.kind))}),h.jsx("span",{className:"settings-select-caret","aria-hidden":"true",children:h.jsx(de,{name:"ChevronDown",size:12})})]})]}),h.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."}),h.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"," ",h.jsx("em",{children:"for"}),", not just what it last did. With this off, continuing still works — it carries the last few turns instead."]})]})}function Ow({workflow:e,isFocused:t,onFocus:i}){const r=wo(e),o=r==="ready",c=r==="ready"?"Deployed to Sapiom with a ready build.":r==="building"?"Cloud build in progress.":r==="failed"?"Cloud build failed.":r==="linked"?"Linked to Sapiom; no ready build confirmed.":"Draft. Not deployed to Sapiom yet.";return h.jsx("div",{className:"workflow-item"+(t?" is-focused":""),"data-testid":`workflow-${e.name}`,...$t({object:"agent"}),children:h.jsxs("button",{className:"tree-row workflow-item-trigger",onClick:()=>i(e.path),"aria-pressed":t,"data-tooltip":t?"Focused agent":"Focus this agent",children:[h.jsx("span",{className:"tree-row-label",title:e.name,children:Xv(e.name)}),h.jsx("span",{className:"workflow-status","data-deployed":o,"data-deployment-state":r,"data-testid":`workflow-status-${e.name}`,title:c,children:h.jsx(de,{name:o?"Cloud":"CloudOff",size:13})})]})})}const Q$=6e4,e6=Kw();function t6(e){return e.plan!==null||e.readout.kind!=="none"}function s6(e){const[t,i]=z.useState(null);return z.useEffect(()=>{let r=!1;i(null);const o=()=>{e6.getAccountPlan().then(f=>{r||i(t6(f)?f:null)},()=>{r||i(null)})};o();const c=setInterval(o,Q$);return()=>{r=!0,clearInterval(c)}},[e]),t}const i6=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),n6=i6?"⌘K":"Ctrl+K";function r6({label:e,cwd:t,isDirectory:i=!0,collapsed:r,onToggleCollapsed:o,onCopyPath:c}){return h.jsxs("div",{className:"workspace-row","data-testid":`workspace-group-${e}`,...$t({object:"workspace"}),children:[h.jsxs("button",{className:"workspace-row-main",onClick:o,title:i?t:e,"aria-expanded":!r,children:[i&&h.jsx(de,{name:r?"Folder":"FolderOpen",size:13}),h.jsx("span",{className:"tree-row-label",children:e}),h.jsx("span",{className:"workspace-caret"+(r?"":" is-open"),"aria-hidden":"true",children:h.jsx(de,{name:"ChevronDown",size:13})})]}),i&&h.jsx("button",{className:"workspace-row-action","aria-label":`Copy path for ${e}`,"data-tooltip":"Copy path",onClick:()=>c(t),children:h.jsx(de,{name:"Copy",size:13})})]})}function a6({label:e,cwd:t,sessionId:i,isFocused:r,onFocus:o,onScaffold:c,onCopyPath:f}){return h.jsxs("div",{className:"workspace-row"+(r?" is-selected":""),"data-testid":`workspace-group-${e}`,...$t({object:"workspace"}),children:[h.jsxs("button",{className:"workspace-row-main","data-testid":`workspace-focus-${e}`,"aria-label":`Focus ${e}`,"aria-pressed":r,"data-tooltip":"Folder with sessions, no agent yet. Focus to work in it.",onClick:()=>o(t),children:[h.jsx(de,{name:"Folder",size:13}),h.jsx("span",{className:"tree-row-label",children:e})]}),h.jsx("button",{className:"workspace-row-action","data-testid":`workspace-scaffold-${e}`,"aria-label":`Scaffold an agent in ${e}`,"data-tooltip":"Scaffold an agent here",onClick:()=>c(i),children:h.jsx(de,{name:"Sparkles",size:13})}),h.jsx("button",{className:"workspace-row-action","aria-label":`Copy path for ${e}`,"data-tooltip":"Copy path",onClick:()=>f(t),children:h.jsx(de,{name:"Copy",size:13})})]})}function o6({label:e,cwd:t,isFocused:i,onFocus:r}){return h.jsxs("div",{className:"workspace-row"+(i?" is-selected":""),"data-testid":`workspace-group-${e}`,...$t({object:"workspace"}),children:[h.jsxs("button",{className:"workspace-row-main","data-testid":`workspace-pending-${e}`,"aria-label":`Creating agent in ${e}`,"aria-busy":"true","data-tooltip":"Creating agent…",onClick:()=>r(t),children:[h.jsx(de,{name:"Folder",size:13}),h.jsx("span",{className:"tree-row-label",children:e})]}),h.jsx("span",{className:"workspace-row-spinner","aria-hidden":"true"})]})}function $w({testid:e,harness:t,title:i,meta:r,cwd:o,resumeMode:c,isSelected:f,onOpen:l}){const d=c==="agent-resume"?"true":c==="rehydrate"?"false":"unknown";return h.jsxs("button",{"data-testid":e,className:"session-dropdown-item"+(f?" is-selected":""),"data-resumable":d,title:o,onClick:l,...$t({object:"session"}),children:[h.jsx("span",{className:"session-item-icon",children:h.jsx(Eg,{kind:t,size:13})}),h.jsxs("span",{className:"session-item-copy",children:[h.jsx("span",{className:"session-item-title",children:i}),h.jsx("span",{className:"session-item-meta",children:r})]})]})}function l6({width:e,minWidth:t,workflows:i,sessions:r,pendingWorkspaces:o,activeSessionId:c,focusedAgentPath:f,onFocusAgent:l,onOpenPalette:d,onConnect:m,onCollapse:y,canGoBack:v,canGoForward:S,onGoBack:w,onGoForward:R,onSelectSession:x,overviewSelected:g,onSelectOverview:b,onNewSession:p,onReviewSummary:_,history:k,historyLoading:A,onOpenHistory:C,recentDirs:N,launchDir:j,listDir:M,onCreateSession:O,listHarnesses:B,onScaffoldSession:q,onScaffoldInSession:V,projectRoot:J,onSaveProjectRoot:ee,onBrowseTemplates:W,templatesActive:Q,onScanWorkflows:ie,onToast:I,telemetryOptIn:P,productAnalyticsOptIn:D,rollingSummary:H,consentSource:U,consentEnvReason:L,authenticated:G,organizationName:se,onToggleTelemetry:Y,onToggleProductAnalytics:F,onToggleRollingSummary:le,editor:ae,onSelectEditor:X,onStartAuth:te,onDisconnect:ue,settingsOpen:me,onSetSettingsOpen:je}){const Oe=s6(G),[Le,at]=z.useState(null);z.useEffect(()=>{const Ae=Xn();if(Ae!=null&&Ae.onUpdateState)return Ae.onUpdateState(Pe=>{at(Pe.kind==="downloaded"?{version:Pe.version}:null)})},[]);const[Ee,qe]=z.useState(!1),We=z.useRef(null),it=z.useRef(null),[Ze,Je]=z.useState(!1),[wt,mt]=z.useState(!1),[Qt,Mt]=z.useState(()=>dn().railGrouping??"workspace"),[At,hs]=z.useState(()=>dn().railSort??"recent"),Ft=Ae=>{Mt(Ae),Kn({railGrouping:Ae}),mt(!1)},pt=Ae=>{hs(Ae),Kn({railSort:Ae}),mt(!1)},xs=z.useRef(null),Lt=z.useCallback(()=>{Je(!1),mt(!1)},[]),[Ns,fs]=z.useState(()=>new Set(dn().collapsedCwds??[])),jt=Ae=>{fs(Pe=>{const Qe=new Set(Pe);return Qe.has(Ae)?Qe.delete(Ae):Qe.add(Ae),Qe})};z.useEffect(()=>{Kn({collapsedCwds:Array.from(Ns)})},[Ns]);const ps=r.filter(Ae=>Ae.status==="exited"),_s=()=>{const Ae=!Ze;if(mt(!1),Je(Ae),Ae){const Pe=ZC(r,N,c);Pe.length>0&&C(Pe)}},Qs=new Set(r.map(Ae=>Ae.id)),ei=new Set(r.map(Ae=>Ae.agentSessionId).filter(Ae=>Ae!=null)),Ks=k.filter(Ae=>!(Ae.harnessSessionId!=null&&Qs.has(Ae.harnessSessionId))&&!ei.has(Ae.agentSessionId)),$s=[...ps.map(Ae=>({kind:"exited",at:Ae.lastActiveAt,session:Ae})),...Ks.map(Ae=>({kind:"summary",at:Ae.lastActiveAt,summary:Ae}))].sort((Ae,Pe)=>Pe.at.localeCompare(Ae.at)),gi=new Map(k.map(Ae=>[Ae.agentSessionId,Ae])),{workspaces:ds,orphanAgents:Ls}=V4(i,r,Qt,At,N,o.map(Ae=>Ae.cwd)),_i=ds.length===0&&Ls.length===0,ys=Ae=>{var Pe;(Pe=navigator.clipboard)==null||Pe.writeText(Ae).then(()=>I("Path copied.","success")).catch(()=>I("Couldn't copy the path."))};return h.jsxs("aside",{ref:it,className:"rail rail-workflows",style:{width:e,minWidth:t},...$t({surface:"agent_rail"}),children:[h.jsx(V$,{onCollapse:y,canGoBack:v,canGoForward:S,onGoBack:w,onGoForward:R}),h.jsxs("nav",{className:"rail-nav","aria-label":"Primary",children:[h.jsxs("button",{type:"button",className:"rail-nav-cta"+(_i?" is-empty":""),"data-testid":"rail-create-new","aria-label":"Create a new agent",onClick:()=>{Je(!1),p()},children:[h.jsx(de,{name:"Plus",size:14}),h.jsx("span",{children:"Create new"})]}),h.jsxs("button",{type:"button",className:"rail-nav-row","data-testid":"palette-trigger","aria-label":"Search sessions, agents, and paths",onClick:d,children:[h.jsx(de,{name:"Search",size:14}),h.jsx("span",{children:"Search"}),h.jsx("span",{className:"rail-nav-kbd",children:n6})]}),h.jsxs("button",{type:"button",className:"rail-nav-row"+(Q?" is-selected":""),"data-testid":"rail-templates","aria-current":Q?"page":void 0,onClick:W,children:[h.jsx(de,{name:"LayoutTemplate",size:14}),h.jsx("span",{children:"Templates"})]}),h.jsxs("button",{type:"button",ref:We,className:"rail-nav-row","data-testid":"add-existing-agents","aria-haspopup":"dialog","aria-expanded":Ee,onClick:()=>{Je(!1),qe(!0)},children:[h.jsx(de,{name:"FolderPlus",size:14}),h.jsx("span",{children:"Add existing agents"})]})]}),h.jsxs("div",{className:"rail-header",children:[h.jsx(de,{name:"Folder",size:14}),h.jsx("span",{className:"rail-header-label",children:"Workspaces"}),h.jsx("div",{className:"rail-header-actions",children:h.jsx("button",{ref:xs,className:"theme-toggle rail-header-btn","data-testid":"history-trigger","aria-label":"Workspace options","aria-haspopup":"menu","aria-expanded":Ze,"data-tooltip":"Grouping, sorting and past sessions",onClick:_s,children:h.jsx(de,{name:"MoreHorizontal",size:14})})})]}),h.jsxs("div",{className:"rail-tree",children:[h.jsx(fn,{open:Ze,anchorRef:xs,onDismiss:Lt,placement:"right-start",besideRef:it,noClip:!0,className:"menu-flyer",testid:"history-menu",children:h.jsxs("div",{className:"menu-flyer-track",children:[h.jsxs("div",{className:"connect-card history-card",children:[h.jsxs("div",{className:"connect-card-header",children:[h.jsx("span",{children:"Workspaces"}),h.jsx("button",{className:"theme-toggle connect-card-close",onClick:Lt,"aria-label":"Close",title:"Close",children:h.jsx(de,{name:"X",size:13})})]}),h.jsxs("div",{className:"connect-card-body",role:"menu",children:[h.jsxs("div",{className:"menu-choice-group",onMouseEnter:()=>mt(!1),children:[h.jsx("div",{className:"session-dropdown-section",children:"Group by"}),h.jsx(Td,{testid:"group-workspace",icon:"FolderOpen",label:"Workspace",checked:Qt==="workspace",onPick:()=>Ft("workspace")}),h.jsx(Td,{testid:"group-deployment",icon:"Cloud",label:"Deployment",checked:Qt==="deployment",onPick:()=>Ft("deployment")}),h.jsx("div",{className:"session-dropdown-section",children:"Sort"}),h.jsx(Td,{testid:"sort-recent",icon:"History",label:"Recent activity",checked:At==="recent",onPick:()=>pt("recent")}),h.jsx(Td,{testid:"sort-name",icon:"ArrowDown",label:"Name",checked:At==="name",onPick:()=>pt("name")})]}),h.jsxs("button",{type:"button",className:"session-dropdown-item nested-trigger"+(wt?" is-open":""),"data-testid":"past-sessions-trigger","aria-haspopup":"menu","aria-expanded":wt,onMouseEnter:()=>mt(!0),onClick:()=>mt(Ae=>!Ae),children:[h.jsx("span",{className:"session-item-icon",children:h.jsx(de,{name:"History",size:13})}),h.jsx("span",{className:"session-item-copy",children:h.jsx("span",{className:"session-item-title",children:"Past sessions"})}),ps.length>0&&h.jsx("span",{className:"session-history-badge","data-testid":"session-history-badge",children:ps.length}),h.jsx(de,{name:"ChevronRight",size:13})]})]})]}),wt&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"menu-flyer-bridge","aria-hidden":"true"}),h.jsxs("div",{className:"connect-card menu-flyer-nested",children:[h.jsxs("div",{className:"connect-card-header",children:[h.jsx("span",{children:"Past sessions"}),h.jsx("button",{className:"theme-toggle connect-card-close",onClick:()=>mt(!1),"aria-label":"Back",title:"Back",children:h.jsx(de,{name:"X",size:13})})]}),h.jsxs("div",{className:"connect-card-body past-sessions-list","data-testid":"past-sessions-card",children:[$s.map(Ae=>{if(Ae.kind==="exited"){const Pe=Ae.session.agentSessionId==null?void 0:gi.get(Ae.session.agentSessionId),Qe=Ae.session.agentSessionId==null?"rehydrate":Pe==null?void 0:Pe.resumeMode;return h.jsx($w,{testid:`exited-session-${Ae.session.id}`,harness:Ae.session.harness,title:Ae.session.title,meta:$v({...Ae.session,gitBranch:Pe==null?void 0:Pe.gitBranch,turnCount:Pe==null?void 0:Pe.turnCount,messageCount:Pe==null?void 0:Pe.messageCount},void 0,{includeHarness:!1,state:z1({resumeMode:Qe,turnCount:Pe==null?void 0:Pe.turnCount})}),cwd:Ae.session.cwd,resumeMode:Qe,isSelected:Ae.session.id===c,onOpen:()=>{x(Ae.session.id),Lt()}},Ae.session.id)}return h.jsx($w,{testid:`history-${Ae.summary.agentSessionId}`,harness:Ae.summary.harness,title:Ae.summary.title,meta:$v(Ae.summary,void 0,{includeHarness:!1,state:z1(Ae.summary)}),cwd:Ae.summary.cwd,resumeMode:Ae.summary.resumeMode,isSelected:!1,onOpen:()=>{_(Ae.summary),Lt()}},Ae.summary.agentSessionId)}),A&&h.jsx("div",{className:"session-dropdown-empty",children:"Loading…"}),!A&&$s.length===0&&h.jsx("div",{className:"session-dropdown-empty",children:"No past sessions yet"})]})]})]})]})}),h.jsxs("div",{className:"rail-list",children:[ds.length===0&&Ls.length===0&&h.jsx(Zi,{className:"rail-empty",icon:"Folder",title:"No agents yet",body:"Open a workspace folder to start a session, or add one. Agents (sapiom.json) appear here automatically."}),ds.map(Ae=>{const Pe=Ns.has(Ae.cwd);if(Ae.pending)return h.jsx("div",{className:"workspace-group",children:h.jsx(o6,{label:Ae.label,cwd:Ae.cwd,isFocused:Ae.cwd===f,onFocus:l})},Ae.cwd);if(Ae.agents.length===0&&Ae.bareSessions.length>0){const Ms=Ae.bareSessions[0];return h.jsx("div",{className:"workspace-group",children:h.jsx(a6,{label:Ae.label,cwd:Ae.cwd,sessionId:Ms.id,isFocused:Ae.cwd===f,onFocus:l,onScaffold:V,onCopyPath:ys})},Ae.cwd)}return h.jsxs("div",{className:"workspace-group",children:[h.jsx(r6,{label:Ae.label,cwd:Ae.cwd,isDirectory:Ae.isDirectory,collapsed:Pe,onToggleCollapsed:()=>jt(Ae.cwd),onCopyPath:ys}),!Pe&&Ae.agents.map(Ms=>h.jsx(Ow,{workflow:Ms.workflow,isFocused:Ms.workflow.path===f,onFocus:l},Ms.workflow.path))]},Ae.cwd)}),Ls.length>0&&h.jsxs("div",{className:"workspace-group",children:[h.jsx("div",{className:"workspace-row",children:h.jsxs("div",{className:"workspace-row-main workspace-row-static","data-tooltip":"Agents that live outside any session folder. Focus one to start a session in its own folder.",children:[h.jsx(de,{name:"Folder",size:13}),h.jsx("span",{className:"tree-row-label",children:"No workspace"})]})}),Ls.map(Ae=>h.jsx(Ow,{workflow:Ae.workflow,isFocused:Ae.workflow.path===f,onFocus:l},Ae.workflow.path))]})]})]}),h.jsxs("div",{className:"rail-footer",children:[Le&&(()=>{const Ae=Xn();return Ae?h.jsx(K$,{desktop:Ae,version:Le.version,onToast:I}):null})(),h.jsx(G$,{plan:Oe}),h.jsx(c6,{onToast:I,authenticated:G,organizationName:se,telemetryOptIn:P,productAnalyticsOptIn:D,rollingSummary:H,consentSource:U,consentEnvReason:L,onToggleTelemetry:Y,onToggleProductAnalytics:F,onToggleRollingSummary:le,editor:ae,onSelectEditor:X,onStartAuth:te,onDisconnect:ue,settingsOpen:me,onSetSettingsOpen:je,overviewSelected:g,onSelectOverview:b})]}),Ee&&h.jsx(Cg,{recentDirs:N,launchDir:j,projectRoot:J,listDir:M,onClose:()=>qe(!1),onConnect:m,onScan:ie,triggerRef:We})]})}function c6({authenticated:e,organizationName:t,telemetryOptIn:i,productAnalyticsOptIn:r,rollingSummary:o,consentSource:c,consentEnvReason:f,onToggleTelemetry:l,onToggleProductAnalytics:d,onToggleRollingSummary:m,editor:y,onSelectEditor:v,onStartAuth:S,onDisconnect:w,settingsOpen:R,onSetSettingsOpen:x,overviewSelected:g,onSelectOverview:b,onToast:p}){const[_,k]=z.useState(!1),[A,C]=z.useState(bh());z.useEffect(()=>Vv(C),[]);const[N,j]=z.useState({status:"idle"}),M=z.useRef(null),O=z.useCallback(()=>k(!1),[]),B=z.useCallback(()=>x(!1),[x]),q=Wv(),V=N.status==="pending",J=Xn(),[ee,W]=z.useState(!1),Q=async()=>{if(!(!J||ee)){W(!0),O();try{const H=await J.checkForUpdates(),U=E2(H);p(U.text,U.tone==="error"?"error":H.kind==="up-to-date"||H.kind==="downloaded"?"success":"info")}catch{p("Couldn't check for updates.")}finally{W(!1)}}};e&&N.status==="pending"&&j({status:"idle"});const ie=V?"Connecting…":e?t??"Signed in":"Not signed in",I=V?"opening browser":e?"Sapiom account":"connect to get started",P=(t??"S").charAt(0).toUpperCase(),D=async()=>{O(),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 h.jsxs("div",{className:"rail-footer-row rail-profile-wrap",children:[h.jsxs("button",{ref:M,className:"rail-profile","data-testid":"brand-identity","aria-haspopup":"menu","aria-expanded":_,title:"Account",onClick:()=>{const H=!_;k(H),H&&B()},children:[h.jsx("span",{className:"rail-profile-avatar","aria-hidden":"true",children:P}),h.jsxs("span",{className:"rail-profile-copy",children:[h.jsx("span",{className:"rail-profile-name",children:ie}),h.jsxs("span",{className:"rail-profile-meta",children:[h.jsx("span",{className:"identity-dot","data-authenticated":e,"data-pending":V}),I]})]}),h.jsx(de,{name:"ChevronDown",size:14})]}),h.jsx(fn,{open:R,anchorRef:M,onDismiss:B,placement:"up-start",matchWidth:!0,className:"settings-popover",testid:"settings-popover",children:h.jsx(Z$,{authenticated:e,organizationName:t,telemetryOptIn:i,productAnalyticsOptIn:r,rollingSummary:o,consentSource:c,consentEnvReason:f,onToggleTelemetry:l,onToggleProductAnalytics:d,onToggleRollingSummary:m,editor:y,onSelectEditor:v,onStartAuth:S,onDisconnect:w})}),h.jsxs(fn,{open:_,anchorRef:M,onDismiss:O,placement:"up-start",matchWidth:!0,className:"profile-menu",role:"menu",testid:"profile-menu",children:[h.jsxs("button",{role:"menuitem",className:"profile-menu-item"+(g?" is-selected":""),"data-testid":"rail-overview",onClick:()=>{b(),O()},children:[h.jsx(de,{name:"Info",size:13}),"Overview"]}),h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-open-dashboard",onClick:()=>{window.open(Jw,"_blank","noopener,noreferrer"),O()},children:[h.jsx(de,{name:"ExternalLink",size:13}),"Open Sapiom dashboard"]}),h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"settings-trigger",onClick:()=>{x(!0),O()},children:[h.jsx(de,{name:"Settings",size:13}),"Settings"]}),h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"theme-toggle",onClick:()=>{Ww(),O()},children:[h.jsx(de,{name:A==="dark"?"Sun":"Moon",size:13}),A==="dark"?"Switch to light mode":"Switch to dark mode"]}),J&&h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-check-updates",disabled:ee,onClick:()=>void Q(),children:[h.jsx(de,{name:ee?"Loader":"RefreshCw",size:13}),ee?"Checking…":"Check for updates",J.appVersion&&h.jsxs("span",{className:"profile-menu-version","data-testid":"app-version",children:["v",J.appVersion]})]}),!e&&h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-connect-account",disabled:V,onClick:()=>void D(),children:[h.jsx(de,{name:"Plug",size:13}),V?"Connecting…":"Connect account"]}),e&&h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-disconnect-account",onClick:()=>{w(),O()},children:[h.jsx(de,{name:"LogOut",size:13}),"Disconnect"]}),q,N.status==="error"&&h.jsx("p",{className:"profile-menu-auth-error","data-testid":"profile-auth-error",children:N.message})]})]})}const u6=new Set([401,403]);function d6(e){return e?e.networkError===!0||e.status===void 0:!1}function h6(e){return(e==null?void 0:e.status)!==void 0&&u6.has(e.status)}function f6(e){const{online:t,error:i}=e;return!t||d6(i)?"offline":h6(i)?"auth":i?"error":"online"}function Lw(){return typeof navigator>"u"?!0:navigator.onLine!==!1}function p6(){const[e,t]=z.useState(Lw);return z.useEffect(()=>{const i=()=>t(Lw());return window.addEventListener("online",i),window.addEventListener("offline",i),i(),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",i)}},[]),e}function Iw(e,t){return e!=null&&e.workflowPath===t}function m6(e=typeof window>"u"?"":window.location.search){const t=new URLSearchParams(e),i=t.get("agent");if(i){const o=t.get("agentSlug");return{kind:"agent",definitionId:i,...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 v6({agentLabel:e,onCancel:t,onConfirm:i}){const r=z.useRef(null);return xo(!0,{onDismiss:t,containerRef:r}),h.jsx("div",{className:"modal-backdrop",onClick:t,children:h.jsxs("div",{ref:r,className:"modal modal-confirm",role:"alertdialog","aria-label":"Clone agent","data-testid":"clone-agent-confirm",onClick:o=>o.stopPropagation(),children:[h.jsxs("div",{className:"modal-header",children:["Clone this agent?",h.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:t,children:h.jsx(de,{name:"X",size:14})})]}),h.jsx("div",{className:"modal-body",children:h.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."]})}),h.jsxs("div",{className:"modal-actions",children:[h.jsx("button",{className:"btn-ghost",autoFocus:!0,onClick:t,children:"Cancel"}),h.jsx("button",{className:"btn-primary","data-testid":"clone-agent-confirm-btn",onClick:i,children:"Clone locally"})]})]})})}const Pw=120,N2=new Set(["attr__class","attr__id"]),g6=/attr__([\w-]+)="(?:\\.|[^"\\])*"/g,_6=/(?:current_url|referrer|pathname)$/,y6=/host$/;function b6(e){const t=typeof e.surface=="string"?e.surface.toLowerCase():"",i=typeof e.object=="string"?e.object.toLowerCase():"";return/secret|vault|credential/.test(t)||/secret|vault|credential/.test(i)}const S6=new Set(["agent","workspace","session","run","directory","file"]);function w6(e){const t=typeof e.object=="string"?e.object.toLowerCase():"";return S6.has(t)}const x6=/\btext="(?:\\.|[^"\\])*"/g,M2=new Set(["localhost","127.0.0.1","[::1]","::1"]),D2="localhost";function Bm(e){if(typeof e!="string"||e.length===0)return e;let t;try{t=new URL(e)}catch{return e}return`${M2.has(t.hostname)?`${t.protocol}//${D2}`:t.origin}${t.pathname}`}function Bw(e){if(typeof e!="string"||e.length===0)return e;const t=e.replace(/:\d+$/,"");return M2.has(t)?D2:e}function kg(e){return e.length>Pw?`${e.slice(0,Pw)}…`:e}function C6(e){return b6(e)?"secret":w6(e)?"drop_name":"truncate"}function E6(e,t){for(const i of Object.keys(e))i.startsWith("attr__")&&!N2.has(i)&&delete e[i];if(t==="truncate"){typeof e.$el_text=="string"&&(e.$el_text=kg(e.$el_text));return}delete e.$el_text}function k6(e,t){const i=e.$elements;if(Array.isArray(i))for(const o of i)o&&typeof o=="object"&&E6(o,t);if(typeof e.$elements_chain!="string")return;if(t==="secret"){delete e.$elements_chain;return}let r=e.$elements_chain.replace(g6,(o,c)=>N2.has(`attr__${c}`)?o:"");t==="drop_name"&&(r=r.replace(x6,'text=""')),e.$elements_chain=r}function A6(e,t){t.$current_url=Bm(t.$current_url),t.$referrer=Bm(t.$referrer),t.$host=Bw(t.$host);for(const i of[e.$set,e.$set_once]){if(!i)continue;const r=i;for(const o of Object.keys(r))_6.test(o)?r[o]=Bm(r[o]):y6.test(o)&&(r[o]=Bw(r[o]))}}const j6=/attr__aria-label="((?:\\.|[^"\\])*)"/i;function R6(e){var o;const t=e.$el_text;if(typeof t=="string"&&t.trim()!=="")return;let i;const r=e.$elements;if(Array.isArray(r))for(const c of r){const f=c==null?void 0:c["attr__aria-label"];if(typeof f=="string"&&f.trim()!==""){i=f;break}}i===void 0&&typeof e.$elements_chain=="string"&&(i=(o=j6.exec(e.$elements_chain))==null?void 0:o[1]),i!==void 0&&i.trim()!==""&&(e.$el_text=kg(i),e.el_text_source="aria_label")}function T6(e,t){typeof e.$el_text=="string"&&(t==="truncate"?e.$el_text=kg(e.$el_text):delete e.$el_text),t==="truncate"&&R6(e),k6(e,t)}function N6(e){if(!e)return e;try{const t=e.properties??{},i=C6(t);return A6(e,t),T6(t,i),e.properties=t,e}catch{return e}}function M6(){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 D6(e){return e.consentSource==="env-forced-off"}function O2(e){return!D6(e)&&e.productAnalyticsOptIn}let mo=!1;function O6(e){if(mo){Hm(e),Um(e);return}const t=M6();if(t&&O2(e)){if(Ni.__loaded){mo=!0,Bv(e),Hm(e),Um(e);return}Ni.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:N6,persistence:"localStorage",disable_session_recording:!0}),mo=!0,Bv(e),Hm(e),Um(e)}}function Hm(e){if(mo)try{O2(e)?Ni.has_opted_out_capturing()&&Ni.opt_in_capturing():Ni.has_opted_out_capturing()||Ni.opt_out_capturing()}catch{}}function Bv(e){pg({app_version:e.version,harness_host:Xn()?"desktop":"cli",studio_boot_id:d4()})}let zm=null;function Um(e){if(mo)try{if(e.authenticated&&e.userId){zm=e.userId,Ni.identify(e.userId),e.tenantId&&Ni.group("organization",e.tenantId,{...e.organizationName?{name:e.organizationName}:{}}),pg({active_organization_id:e.tenantId??void 0,app_version:e.version});return}zm&&(zm=null,Ni.reset(),Bv(e))}catch{}}function $6(e){if(mo)try{e?pg({harness_kind:e}):Ni.unregister("harness_kind")}catch{}}function L6(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(`
491
+ `)}const I6={entries:[],index:-1};function P6(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==="review"&&t.kind==="review"?e.summary.agentSessionId===t.summary.agentSessionId:e.kind===t.kind}function $2(e){return e.index>0}function L2(e){return e.index>=0&&e.index<e.entries.length-1}function B6(e,t){const i=e.index>=0?e.entries[e.index]:null;if(i&&P6(i,t)){if(JSON.stringify(i)===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 H6(e,t){if(!(t==="back"?$2(e):L2(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 z6(){const[e,t]=z.useState(I6),i=z.useRef(e);i.current=e;const r=z.useCallback(c=>{const f=B6(i.current,c);f!==i.current&&(i.current=f,t(f))},[]),o=z.useCallback(c=>{const f=H6(i.current,c);return f.visit?(i.current=f.state,t(f.state),f.visit):null},[]);return{canGoBack:$2(e),canGoForward:L2(e),record:r,goBack:()=>o("back"),goForward:()=>o("forward")}}const I2="(max-width: 768px)";function Hv(){return typeof window<"u"&&window.matchMedia(I2).matches}function U6(e){const t=window.matchMedia(I2);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function q6(){return z.useSyncExternalStore(U6,Hv,()=>!1)}const P2="sapiom-harness-pane-widths",Ag=180,B2=480,zv=320,ac=320,H2=720;function Uv(e,t,i){return Math.min(Math.max(e,t),i)}function F6(){const e={rail:zv,canvas:null};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(P2);if(!t)return e;const i=JSON.parse(t);return{rail:Uv(typeof i.rail=="number"?i.rail:zv,Ag,B2),canvas:typeof i.canvas=="number"?Uv(i.canvas,ac,H2):null}}catch{return e}}function Hw(e){window.localStorage.setItem(P2,JSON.stringify(e))}function V6(){const[e,t]=z.useState(F6),[i,r]=z.useState(!1),[o,c]=z.useState(!1),f=(d,m,y,v,S,w)=>R=>{const x=R.currentTarget;x.setPointerCapture(R.pointerId),w==null||w(!0);const g=R.clientX,b=S(),p=k=>{const A=Uv(b+(k.clientX-g)*m,y,v);t(C=>C[d]===A?C:{...C,[d]:A})},_=()=>{x.removeEventListener("pointermove",p),x.removeEventListener("pointerup",_),w==null||w(!1),t(k=>(Hw(k),k))};x.addEventListener("pointermove",p),x.addEventListener("pointerup",_)},l=(d,m)=>{t(y=>{const v={...y,[d]:m};return Hw(v),v})};return{widths:e,canvasResizing:i,railResizing:o,startRailDrag:f("rail",1,Ag,B2,()=>e.rail,c),startCanvasDrag:f("canvas",-1,ac,H2,()=>{if(e.canvas!=null)return e.canvas;const d=document.querySelector(".canvas-pane");return d?d.getBoundingClientRect().width:ac},r),resetRail:()=>{c(!0),l("rail",zv),window.setTimeout(()=>c(!1),0)},resetCanvas:()=>{r(!0),l("canvas",null),window.setTimeout(()=>r(!1),0)}}}function Fs(e,t="error"){return{message:e,tone:t}}const W6=2e3;function G6(e){const t=new URL("/ws/events",window.location.href);t.protocol=t.protocol==="https:"?"wss:":"ws:",t.searchParams.set("token",co());let i=null,r=null,o=!1;const c=()=>{i=new WebSocket(t),i.addEventListener("message",f=>{try{e(JSON.parse(f.data))}catch{}}),i.addEventListener("close",()=>{o||(r=setTimeout(c,W6))})};return c(),()=>{o=!0,r&&clearTimeout(r),i==null||i.close()}}function Nd(e){const t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]??e}function K6(e,t){const i=[];for(const r of t)e.has(r.path)||i.push(r.path);return i}function zw(e,t){return t?"exception":e==="linking"?"link_failed":"build_failed"}function Y6(e){return e==="cancelled"?"cancelled":"failed"}function X6(e){return e==="completed"?"succeeded":e==="failed"?"failed":"pending"}const J6=5;function Z6(){return{started:!1,settled:!1,observed:!1,failures:0}}const Md={event:null};function Q6(e,t,i=J6){if(t.kind==="announced")return t.duplicate||e.started?{state:e,emit:Md}:{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:Md};if(e.settled)return{state:c,emit:Md};const f={...c,settled:!0};return t.status==="completed"?{state:f,emit:{event:"agent.run_succeeded"}}:{state:f,emit:{event:"agent.run_failed",error_kind:Y6(t.status)}}}const r=e.failures+1,o={...e,failures:r};return r<i||e.settled?{state:o,emit:Md}:{state:{...o,settled:!0},emit:{event:"agent.run_failed",error_kind:e.observed?"exception":"unobservable"}}}function Xl(e){return typeof e=="string"&&e!==""?e:void 0}function eL(e){if(Xl(e.templateId))return"template";const t=Xl(e.starterId);return t&&t!=="default"?"starter":Xl(e.forkId)?"fork":"scratch"}function Uw(e){if(!e)return{};const t=eL(e);return t==="template"?{source:t,template_id:Xl(e.templateId)}:t==="starter"?{source:t,template_id:Xl(e.starterId)}:{source:t}}const qw=4e3;function tL(e){if(typeof e=="string")return e;if(e!==null&&typeof e=="object"){const t=e,i=[t.ts,t.level,t.msg??t.message].filter(r=>typeof r=="string"||typeof r=="number");if(i.length>0)return i.map(String).join(" ")}return String(e)}function sL(e){if(!Array.isArray(e)||e.length===0)return;const t=e.map(tL).join(`
492
+ `).trim();if(t!=="")return t.length>qw?t.slice(t.length-qw):t}function iL(e){return e==="running"?"running":e==="succeeded"?"passed":e==="threw"?"failed":"pending"}function nL(e){return e==="completed"?"completed":e==="failed"?"failed":"running"}function rL(e){var r;const t={id:`${e.step}-${e.attempt}`,name:e.step,attempt:e.attempt,status:iL(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 i=sL(e.logs);return i!==void 0&&(t.logSlice=i),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 aL(e,t={}){const i={executionId:t.executionId??"",status:nL(t.outcome),steps:e.map(rL),stubbed:!0};return t.unusedStubs&&t.unusedStubs.length>0&&(i.unusedStubs=t.unusedStubs),t.stubWarnings&&t.stubWarnings.length>0&&(i.stubWarnings=t.stubWarnings),t.input!==void 0&&(i.input=t.input),t.output!==void 0&&(i.output=t.output),t.error!==void 0&&(i.error=t.error),t.startedAt&&(i.startedAt=t.startedAt),t.finishedAt&&(i.finishedAt=t.finishedAt),i}const Pt=Kw(),oL=3e3,lL=8,cL=500;function uL(){const[e,t]=z.useState(null),[i,r]=z.useState(null),o=z.useRef(null);o.current=i;const c=z.useRef([]);c.current=(e==null?void 0:e.workflows)??[];const[f,l]=z.useState(!0),[d,m]=z.useState(null),[y,v]=z.useState(null),[S,w]=z.useState(0),[R,x]=z.useState(null),[g,b]=z.useState(null),[p,_]=z.useState([]),[k,A]=z.useState(null),[C,N]=z.useState(!1),j=z.useRef(new Map),M=z.useRef(0),O=z.useRef(new Map),[B,q]=z.useState(null),[V,J]=z.useState(new Set),[ee,W]=z.useState([]),Q=z.useRef(new Map),[ie,I]=z.useState(new Map),[P,D]=z.useState(new Map),[H,U]=z.useState(new Map),L=z.useRef(new Map),G=z.useRef(new Set),[se,Y]=z.useState(new Map),[F,le]=z.useState(new Map),[ae,X]=z.useState(new Map),te=z.useCallback((oe,fe)=>{X(ye=>{if(fe===null){if(!ye.has(oe))return ye;const xe=new Map(ye);return xe.delete(oe),xe}return new Map(ye).set(oe,fe)})},[]),[ue,me]=z.useState([]),je=z.useCallback(oe=>{me(fe=>fe.some(ye=>ye.cwd===oe)?fe:[{cwd:oe,sessionSeen:!1},...fe])},[]),Oe=z.useCallback(oe=>{me(fe=>fe.some(ye=>ye.cwd===oe)?fe.filter(ye=>ye.cwd!==oe):fe)},[]);z.useEffect(()=>{if(ue.length===0)return;const oe=(e==null?void 0:e.sessions)??[],fe=(e==null?void 0:e.workflows)??[],ye=(xe,Te)=>mg(Te,xe);me(xe=>{let Te=!1;const ct=[];for(const xt of xe){if(fe.some(Ct=>ye(Ct.path,xt.cwd))){Te=!0;continue}const Rt=oe.some(Ct=>Ct.status!=="exited"&&ye(Ct.cwd,xt.cwd));if(xt.sessionSeen&&!Rt){Te=!0;continue}if(Rt&&!xt.sessionSeen){ct.push({...xt,sessionSeen:!0}),Te=!0;continue}ct.push(xt)}return Te?ct:xe})},[e==null?void 0:e.sessions,e==null?void 0:e.workflows,ue]);const[Le,at]=z.useState(0),Ee=z.useCallback(()=>{at(oe=>oe+1)},[]),qe=z.useRef(0),We=z.useCallback(oe=>{qe.current+=1,b(oe)},[]),it=z.useRef([]),Ze=z.useCallback(oe=>{Pt.getRunState(oe).then(fe=>I(ye=>{const xe=ye.get(oe);return xe?new Map(ye).set(oe,{...xe,run:fe}):ye})).catch(()=>{})},[]),Je=z.useCallback((oe,fe,ye)=>{const xe=L.current.get(oe);xe&&clearInterval(xe);const Te=ra(it.current.find(Fe=>Fe.id===oe)),ct=Date.now();D(Fe=>{const Ke=Fe.get(oe)??[];return Ke.includes(fe)?Fe:new Map(Fe).set(oe,[...Ke,fe])}),U(Fe=>{if(!Fe.has(oe))return Fe;const Ke=new Map(Fe);return Ke.delete(oe),Ke});const Dt={workflow_slug:Te?Nd(Te):void 0,session_id:oe,target:ye};let Rt=Z6();const Ct=Fe=>{const{state:Ke,emit:es}=Q6(Rt,Fe);if(Rt=Ke,es.event===null)return;if(es.event==="agent.run_started"){Os("agent.run_started",Dt);return}const Ye=Date.now()-ct;if(es.event==="agent.run_succeeded"){Os("agent.run_succeeded",{...Dt,duration_ms:Ye});return}Os("agent.run_failed",{...Dt,duration_ms:Ye,error_kind:es.error_kind})},ve=G.current.has(fe);if(G.current.size>=cL){const Fe=G.current.values().next().value;Fe!==void 0&&G.current.delete(Fe)}G.current.add(fe),Ct({kind:"announced",duplicate:ve});const $e=()=>{const Fe=L.current.get(oe);Fe&&clearInterval(Fe),L.current.delete(oe)},Be=async()=>{try{const Fe=await Pt.getRunState(fe);I(Ke=>new Map(Ke).set(fe,{run:Fe,target:ye,workflowPath:Te,observedAt:ct})),Ct({kind:"polled",status:Fe.status}),Fe.status!=="running"&&$e()}catch{Ct({kind:"poll_failed"}),Rt.settled&&$e()}};Be(),L.current.set(oe,setInterval(()=>void Be(),2e3))},[]),wt=z.useRef(0),mt=z.useCallback(async(oe,fe,ye)=>{wt.current+=1;const xe=`local-${Date.now()}-${wt.current}`,Te=ra(it.current.find(et=>et.id===oe)),ct=Date.now(),xt=new Date(ct).toISOString(),Dt=[];let Rt,Ct,ve,$e,Be,Fe;D(et=>{const dt=et.get(oe)??[];return dt.includes(xe)?et:new Map(et).set(oe,[...dt,xe])}),U(et=>{if(!et.has(oe))return et;const dt=new Map(et);return dt.delete(oe),dt});const Ke=()=>{const et=aL(Dt,{executionId:xe,outcome:Rt,unusedStubs:Be,stubWarnings:Fe,input:ye,output:Ct,error:ve,startedAt:xt,finishedAt:$e});I(dt=>new Map(dt).set(xe,{run:et,target:"local",workflowPath:Te,observedAt:ct}))};Ke();const es={workflow_slug:Te?Nd(Te):void 0,session_id:oe,target:"local"};let Ye=!1;Os("agent.run_started",es);const ts=et=>{if(et.kind==="summary")Rt=et.outcome,Ct=et.output,ve=et.error,$e=new Date().toISOString(),Be=et.unusedStubs,Fe=et.stubWarnings;else if(et.kind==="error"){Rt="failed",ve=et.error,$e=new Date().toISOString();const dt={step:"run-local",attempt:1,input:ye,status:"threw",startedAt:xt,finishedAt:$e,error:{name:"RunLocalError",message:et.error},logs:[]},It=Dt.findIndex(Ys=>Ys.step===dt.step&&Ys.attempt===dt.attempt);It>=0?Dt[It]=dt:Dt.push(dt)}else if(et.kind==="step"){const dt=et.trace,It=Dt.findIndex(Ys=>Ys.step===dt.step&&Ys.attempt===dt.attempt);It>=0?Dt[It]=dt:Dt.push(dt)}else{const dt=Dt.findIndex(It=>It.step===et.step&&It.attempt===et.attempt);dt>=0?Dt[dt]=et:Dt.push(et)}Ke()};try{await Pt.runLocal({sourceDir:fe,input:ye},ts)}catch(et){const dt=et instanceof ji&&et.reason?et.reason:et instanceof Error?et.message:"Local execution failed.";Rt="failed",Ye=!0,ve=dt,$e=new Date().toISOString();const It={step:"run-local",attempt:1,input:ye,status:"threw",startedAt:xt,finishedAt:$e,error:{name:"RunLocalError",message:dt},logs:[{level:"error",msg:dt}]},Ys=Dt.findIndex(nn=>nn.step===It.step&&nn.attempt===It.attempt);Ys>=0?Dt[Ys]=It:Dt.push(It),Ke(),A(Fs(dt))}finally{const et=X6(Rt),dt=Date.now()-ct;et==="succeeded"?Os("agent.run_succeeded",{...es,duration_ms:dt}):et==="failed"&&Os("agent.run_failed",{...es,duration_ms:dt,error_kind:Ye?"exception":"failed"}),Ee()}},[Ee]),Qt=z.useCallback((oe,fe)=>{U(ye=>new Map(ye).set(oe,fe)),Ze(fe)},[Ze]),Mt=z.useMemo(()=>{const oe=new Map;return P.forEach((fe,ye)=>{const xe=H.get(ye),Te=xe&&fe.includes(xe)?xe:fe[fe.length-1],ct=Te?ie.get(Te):void 0;ct&&oe.set(ye,ct)}),oe},[P,H,ie]);z.useEffect(()=>{it.current=(e==null?void 0:e.sessions)??[]},[e]),z.useEffect(()=>{const oe=L.current;return()=>{oe.forEach(fe=>clearInterval(fe)),oe.clear()}},[]),z.useEffect(()=>{const oe=Q.current;return()=>{oe.forEach(fe=>clearTimeout(fe)),oe.clear()}},[]);const At=z.useRef(null);z.useEffect(()=>{let oe=!1;return S>0&&(l(!0),m(null),v(null)),Promise.all([Pt.getState(),Pt.getSettings()]).then(([fe,ye])=>{if(oe)return;t(fe);const xe=At.current??(At.current=new Set);for(const ct of fe.workflows)xe.add(ct.path);r(ye),v(null),fe.tasks&&W(fe.tasks);const Te=fe.sessions.find(ct=>ct.status!=="exited");Te&&b(Te.id),fe.workflows[0]&&x(fe.workflows[0].path)}).catch(fe=>{oe||(m(fe.message),v(fe instanceof ji?{status:fe.status}:{networkError:!0}))}).finally(()=>!oe&&l(!1)),()=>{oe=!0}},[S]);const hs=z.useCallback(()=>w(oe=>oe+1),[]);z.useEffect(()=>{if(!g)return;const oe=e==null?void 0:e.sessions.find(fe=>fe.id===g);x(ra(oe)??null)},[g]);const Ft=z.useCallback(async()=>{const oe=await Pt.listWorkflows();return t(fe=>fe&&{...fe,workflows:oe}),oe},[]);z.useEffect(()=>G6(oe=>{if(q(oe),oe.type==="session.status"){if(t(fe=>{if(!fe)return fe;const xe=fe.sessions.some(Te=>Te.id===oe.session.id)?fe.sessions.map(Te=>Te.id===oe.session.id?oe.session:Te):[...fe.sessions,oe.session];return{...fe,sessions:xe}}),oe.session.status==="exited"){const fe=oe.session.id,ye=Q.current.get(fe);ye&&(clearTimeout(ye),Q.current.delete(fe)),J(xe=>{if(!xe.has(fe))return xe;const Te=new Set(xe);return Te.delete(fe),Te})}}else if(oe.type==="workflows.changed")Ft().then(fe=>{const ye=At.current;if(ye===null){At.current=new Set(fe.map(xe=>xe.path));return}for(const xe of K6(ye,fe))ye.add(xe),Os("agent.created",{workflow_slug:Nd(xe),...Uw(fe.find(Te=>Te.path===xe))})});else if(oe.type==="execution.started")Je(oe.harnessSessionId,oe.executionId,oe.target);else if(oe.type==="port.detected")Y(fe=>new Map(fe).set(oe.harnessSessionId,{port:oe.port,url:oe.url}));else if(oe.type==="task.status")W(fe=>fe.some(xe=>xe.id===oe.task.id)?fe.map(xe=>xe.id===oe.task.id?oe.task:xe):[...fe,oe.task]);else if(oe.type==="session.activity"){const fe=oe.harnessSessionId;J(xe=>xe.has(fe)?xe:new Set(xe).add(fe));const ye=Q.current.get(fe);ye&&clearTimeout(ye),Q.current.set(fe,setTimeout(()=>{Q.current.delete(fe),J(xe=>{if(!xe.has(fe))return xe;const Te=new Set(xe);return Te.delete(fe),Te})},oL))}else oe.type==="auth.changed"&&(t(fe=>fe&&{...fe,authenticated:oe.authenticated,organizationName:oe.organizationName}),Ft())}),[Ft,Je]);const pt=z.useCallback(async oe=>{const fe=Array.from(new Set(oe)),ye=fe.map(xe=>{const Te=j.current.get(xe);if(Te)return Te;const ct=Pt.sessionHistory(xe).finally(()=>{j.current.delete(xe)});return j.current.set(xe,ct),ct});M.current+=1,N(!0);try{const xe=await Promise.allSettled(ye),Te=[],ct=new Set;xe.forEach((xt,Dt)=>{xt.status==="fulfilled"&&(ct.add(fe[Dt]),Te.push(...xt.value))}),_(xt=>k5(xt,Te,ct))}finally{M.current-=1,M.current===0&&N(!1)}},[]),xs=z.useCallback(async oe=>{var xe;const fe=await Pt.createSession(oe);t(Te=>Te&&!Te.sessions.some(ct=>ct.id===fe.id)?{...Te,sessions:[...Te.sessions,fe]}:Te),We(fe.id);const ye=[oe.cwd,...(((xe=o.current)==null?void 0:xe.recentDirs)??[]).filter(Te=>Te!==oe.cwd)].slice(0,lL);r(Te=>Te&&{...Te,recentDirs:ye});try{const Te=await Pt.updateSettings({recentDirs:ye});r(ct=>ct&&{...ct,recentDirs:Te.recentDirs})}catch{}return fe},[We]),Lt=z.useCallback((oe,fe)=>Pt.attachFile(oe,fe),[]),Ns=z.useCallback(()=>Pt.listTemplates(),[]),fs=z.useCallback(oe=>Pt.getTemplate(oe),[]),jt=z.useCallback(oe=>Pt.sessionRecord(oe),[]),ps=z.useCallback(async oe=>{const fe=qe.current;try{const ye=await Pt.resumeSession(oe);return t(xe=>xe&&{...xe,sessions:xe.sessions.map(Te=>Te.id===ye.id?ye:Te)}),qe.current===fe&&We(ye.id),ye}catch(ye){throw A(Fs(ye instanceof ji&&ye.reason?ye.reason:ye.message)),ye}},[We]),_s=z.useCallback(async({cwd:oe,harness:fe,from:ye})=>{const xe=await xs({cwd:oe,harness:fe,rehydrateFrom:ye});return xe.rehydratedFrom||A(Fs("Nothing was recorded for that session, so this one starts fresh.","info")),xe},[xs]),Qs=z.useCallback(async oe=>{var ye;const fe=oe.harnessSessionId??((ye=e==null?void 0:e.sessions.find(xe=>xe.agentSessionId===oe.agentSessionId))==null?void 0:ye.id);if(oe.resumeMode==="rehydrate")return _s({cwd:oe.cwd,harness:oe.harness,from:fe??oe.agentSessionId});if(fe)return ps(fe);try{const xe=await Pt.adoptSession({agentSessionId:oe.agentSessionId,harness:oe.harness,cwd:oe.cwd,title:oe.title,lastActiveAt:oe.lastActiveAt});return t(Te=>{if(!Te)return Te;const ct=Te.sessions.some(xt=>xt.id===xe.id)?Te.sessions.map(xt=>xt.id===xe.id?xe:xt):[...Te.sessions,xe];return{...Te,sessions:ct}}),We(xe.id),xe}catch(xe){throw A(Fs(xe instanceof ji&&xe.reason?xe.reason:xe.message)),xe}},[e,ps,_s,We]),ei=z.useCallback(async oe=>{try{await Pt.killSession(oe)}catch(ye){throw A(Fs(ye instanceof ji&&ye.reason?ye.reason:ye.message)),ye}const fe=((e==null?void 0:e.sessions)??[]).filter(ye=>ye.id!==oe);if(t(ye=>ye&&{...ye,sessions:fe}),g===oe){const ye=fe.find(xe=>xe.status!=="exited");We(ye?ye.id:null)}},[e,g,We]),Ks=z.useCallback(async oe=>{const fe=await Pt.connectWorkflow(oe);return t(ye=>ye&&{...ye,workflows:[...ye.workflows.filter(xe=>xe.path!==fe.path),fe]}),(At.current??(At.current=new Set)).add(fe.path),fe},[]),$s=z.useCallback(async oe=>{const fe=await Pt.scanWorkflows(oe),ye=await Ft(),xe=At.current??(At.current=new Set);for(const Te of ye)xe.add(Te.path);return fe},[Ft]),gi=z.useCallback(()=>Pt.listHarnesses(),[]),ds=z.useCallback(async(oe,fe)=>{const ye=await Pt.bindWorkflow(oe,fe);t(xe=>xe&&{...xe,sessions:xe.sessions.map(Te=>Te.id===ye.id?ye:Te)})},[]),Ls=z.useCallback(async oe=>{const fe=await Pt.updateSettings(oe);return r(fe),oe.telemetryOptIn!==void 0&&t(ye=>ye&&{...ye,telemetryOptIn:fe.telemetryOptIn}),oe.productAnalyticsOptIn!==void 0&&t(ye=>ye&&{...ye,productAnalyticsOptIn:fe.productAnalyticsOptIn!==!1}),fe},[]),_i=z.useCallback(async(oe,fe)=>{try{await Pt.runMacro(oe,fe)}catch(ye){A(Fs(ye instanceof ji&&ye.reason?ye.reason:ye.message))}},[]),ys=z.useCallback(oe=>{const fe=O.current.get(oe);if(fe)return fe;const ye=(async()=>{A(Fs("Deploying…","info"));const xe=Nd(oe),Te=Uw(c.current.find(Ct=>Ct.path===oe)),ct=performance.now();Os("agent.deploy_started",{workflow_slug:xe,...Te});let xt=null,Dt=null,Rt=!1;try{const Ct=await Pt.deploy(oe,ve=>{ve.phase==="linking"?(xt="linking",te(oe,{phase:"linking"}),A(Fs(`Deploying — creating the agent "${ve.name}" on Sapiom…`,"info"))):ve.phase==="warning"?(Dt=ve.message,A(Fs(ve.message))):ve.phase==="building"&&(xt="building",te(oe,{phase:"building"}),A(Fs("Deploying — building on Sapiom…","info")),Ft())});if(Ct.phase==="ready")te(oe,{phase:"ready"}),Os("agent.deploy_succeeded",{workflow_slug:xe,duration_ms:Math.round(performance.now()-ct),...Te}),Rt=!0,A(Dt?Fs(`Deployed to Sapiom. ${Dt}`):Fs("Deployed to Sapiom.","success")),le(ve=>{if(!ve.has(oe))return ve;const $e=new Map(ve);return $e.delete(oe),$e}),await Ft();else if(Ct.phase==="error"){const ve=xt==="linking"?"Couldn't create the agent":"Deploy failed",$e=Ct.hint?`${ve}: ${Ct.message} (${Ct.hint})`:`${ve}: ${Ct.message}`;te(oe,{phase:"error",message:$e}),Os("agent.deploy_failed",{workflow_slug:xe,error_kind:zw(xt,!1),...Te}),Rt=!0,A(Fs($e)),le(Be=>new Map(Be).set(oe,$e)),await Ft()}}catch(Ct){const ve=Ct instanceof ji&&Ct.reason?Ct.reason:Ct.message;te(oe,{phase:"error",message:ve}),Rt||Os("agent.deploy_failed",{workflow_slug:xe,error_kind:zw(xt,!0),...Te}),A(Fs(ve)),le($e=>new Map($e).set(oe,ve))}finally{Ee(),O.current.delete(oe)}})();return O.current.set(oe,ye),ye},[Ft,Ee,te]),Ae=z.useCallback(async(oe,fe,ye)=>{try{const{executionId:xe}=await Pt.run({definitionId:fe,input:ye});Je(oe,xe,"prod")}catch(xe){A(Fs(xe instanceof ji&&xe.reason?xe.reason:xe.message))}finally{Ee()}},[Je,Ee]),Pe=z.useCallback(async()=>Pt.startAuth(),[]),Qe=z.useCallback(async()=>{try{await Pt.disconnect()}catch(oe){A(Fs(oe instanceof ji&&oe.reason?oe.reason:oe.message))}},[]),Ms=z.useCallback(()=>A(null),[]),Is=z.useCallback(async(oe,fe)=>{await Pt.injectInput(oe,{text:fe,submit:!0})},[]),Cs=z.useCallback((oe,fe="error")=>{A(Fs(oe,fe))},[]),sn=z.useCallback(oe=>F.get(oe)??null,[F]),Di=z.useCallback(oe=>Pt.listDir(oe),[]),li=z.useCallback(oe=>Pt.getWorkflowInputContract(oe),[]);return{state:e,loading:f,error:d,errorKind:y,reload:hs,settings:i,bootToken:co(),selectedWorkflowPath:R,setSelectedWorkflowPath:x,activeSessionId:g,setActiveSessionId:We,history:p,historyLoading:C,loadHistory:pt,createSession:xs,attachFile:Lt,listTemplates:Ns,getTemplate:fs,getWorkflowInputContract:li,sessionRecord:jt,resumeSession:ps,rehydrateSession:_s,resumeFromHistory:Qs,closeSession:ei,connectWorkflow:Ks,scanWorkflows:$s,listHarnesses:gi,bindWorkflow:ds,updateSettings:Ls,runMacro:_i,deploy:ys,startProdRun:Ae,runLocal:mt,injectInput:Is,showToast:Cs,lastDeployErrorFor:sn,deployStateByPath:ae,dismissDeployState:oe=>te(oe,null),pendingWorkspaces:ue,addPendingWorkspace:je,removePendingWorkspace:Oe,directActionSettleSeq:Le,listDir:Di,lastMessage:B,runsBySession:Mt,runsByExecution:ie,runIdsBySession:P,selectRun:Qt,previewBySession:se,toast:k,dismissToast:Ms,busySessionIds:V,tasks:ee,api:Pt,startAuth:Pe,disconnect:Qe}}const dL=10*6e4,hL=4e3;function Ll(e,t){return t?e.filter(i=>i.status!=="exited"&&(Nv(i.boundWorkflowPath??"",t)||i.boundWorkflowPath==null&&Nv(i.cwd,t))).sort((i,r)=>i.createdAt.localeCompare(r.createdAt)||i.id.localeCompare(r.id)):[]}const fL=()=>{var fa,mn,Ao,jo,vn,uc,Ro,To,pa,dc,hc,Er,Oi,ma,va,gn,_n,No,ga,Mo,Jn;const e=uL(),t=p6(),[i,r]=z.useState(!1),[o,c]=z.useState(null),f=z.useRef(new Map),l=z.useCallback(async Z=>{const Se=f.current.get(Z);try{const Ne=await e.getWorkflowInputContract(Z);return Ne.status==="unavailable"&&Se?Se:Ne}catch(Ne){if(Se)return Se;throw Ne}},[e.getWorkflowInputContract]),[d,m]=z.useState(!1),[y,v]=z.useState(!1),S=z.useRef(!1),[w,R]=z.useState(null),x=z.useRef(null),g=z.useRef(null),b=z.useRef(m6()),p=z.useRef(!1),_=z.useRef(null),[k,A]=z.useState(null),[C,N]=z.useState(null),[j,M]=z.useState(!1),[O,B]=z.useState(()=>{const Z=dn().rightTab;return Z==="canvas"||Z==="steps"||Z==="code"?Z:"canvas"}),[q,V]=z.useState(O==="code"),[J,ee]=z.useState(null),[W,Q]=z.useState(!1),[ie,I]=z.useState(!1),[P,D]=z.useState(()=>dn().sessionNames??{}),H=(Z,Se)=>{D(Ne=>{const ze={...Ne},Et=Se.trim();return Et?ze[Z]=Et:delete ze[Z],Kn({sessionNames:ze}),ze})},U=z.useRef(new Map),L=z.useRef([]),G=z.useCallback(Z=>{const Se=U.current.get(Z);if(Se)return window.clearTimeout(Se.timer),window.clearTimeout(Se.hintTimer),U.current.delete(Z),Se},[]),se=z.useCallback(Z=>{const Se=U.current.get(Z);if(!Se)return;const Ne=L.current.find(ze=>ze.id===Z);Ne&&(Ne.ready?(G(Z),e.injectInput(Z,Se.prompt).catch(()=>e.showToast(Se.failMessage))):Ne.status==="exited"&&(G(Z),e.showToast(Se.failMessage)))},[G,e.injectInput,e.showToast]),Y=z.useCallback((Z,Se,Ne)=>{G(Z);const ze=window.setTimeout(()=>{G(Z)&&e.showToast(Ne)},dL),Et=window.setTimeout(()=>{U.current.has(Z)&&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.")},hL);U.current.set(Z,{prompt:Se,failMessage:Ne,timer:ze,hintTimer:Et}),se(Z)},[G,e.showToast,se]);z.useEffect(()=>{var Z;if(L.current=((Z=e.state)==null?void 0:Z.sessions)??[],U.current.size!==0)for(const Se of[...U.current.keys()])se(Se)},[(fa=e.state)==null?void 0:fa.sessions,se]);const[F,le]=z.useState(()=>Hv()||(dn().railCollapsed??!1)),[ae,X]=z.useState(()=>Hv()||(dn().rightCollapsed??!1)),[te,ue]=z.useState(!1),me=q6(),je=z6(),{widths:Oe,canvasResizing:Le,railResizing:at,startRailDrag:Ee,startCanvasDrag:qe,resetRail:We,resetCanvas:it}=V6(),[Ze,Je]=z.useState(!1),wt=z.useRef(!1),mt=z.useRef(null),Qt=z.useRef(null),Mt=z.useRef(!1),At=z.useRef(!1),hs=z.useRef(null),Ft=z.useRef(null),pt=z.useCallback(Z=>{Z&&!wt.current&&Z.style.setProperty("--rp-w",`${Z.offsetWidth}px`)},[]),xs=z.useCallback(Z=>{var Ne;if((Ne=Ft.current)==null||Ne.disconnect(),hs.current=Z,!Z){Ft.current=null;return}const Se=new ResizeObserver(()=>{At.current||pt(Z)});Se.observe(Z),Ft.current=Se},[pt]);wt.current=ae,At.current=Ze,z.useLayoutEffect(()=>{if(me)return;Je(!0);const Z=window.setTimeout(()=>{Je(!1),pt(hs.current)},260);return()=>window.clearTimeout(Z)},[ae,me,pt]),z.useEffect(()=>{const Z=Se=>{var ze;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 ms=Ll(((ze=e.state)==null?void 0:ze.sessions)??[],w)[Number(Se.key)-1];ms&&(Se.preventDefault(),m(!1),ee(null),Q(!1),I(!1),e.setActiveSessionId(ms.id))}};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[(mn=e.state)==null?void 0:mn.sessions,w]);const Lt=l5({settingsRoot:(Ao=e.settings)==null?void 0:Ao.projectRoot,defaultProjectRoot:(jo=e.state)==null?void 0:jo.defaultProjectRoot,launchDir:(vn=e.state)==null?void 0:vn.launchDir}),Ns=async Z=>{await e.updateSettings({projectRoot:Z})};z.useEffect(()=>{var Se;if(!i||!e.state)return;const Z=ZC(e.state.sessions,((Se=e.settings)==null?void 0:Se.recentDirs)??[],e.activeSessionId);Z.length>0&&e.loadHistory(Z)},[i]);const fs=z.useRef(!1);z.useEffect(()=>{var Se;if(fs.current||!e.state)return;fs.current=!0;const Z=e.state.sessions.find(Ne=>Ne.id===e.activeSessionId);R(ra(Z)??((Se=e.state.workflows[0])==null?void 0:Se.path)??null)},[e.state,e.activeSessionId]);const jt=e.state;z.useEffect(()=>{jt&&O6(jt)},[jt,jt==null?void 0:jt.authenticated,jt==null?void 0:jt.userId,jt==null?void 0:jt.tenantId,jt==null?void 0:jt.consentSource,jt==null?void 0:jt.productAnalyticsOptIn,jt==null?void 0:jt.version]),z.useEffect(()=>{if(!jt)return;const Z=jt.sessions.find(Ne=>Ne.id===e.activeSessionId),Se={firstRun:jt.firstRun===!0,settingsOpen:j,templatesOpen:W,hasLiveSession:jt.sessions.some(Ne=>Ne.status!=="exited"),inspectingDeadSession:(Z==null?void 0:Z.status)==="exited",rightTab:O};h4(Se),$6((Z==null?void 0:Z.harness)??null)},[jt,e.activeSessionId,j,W,O]);const ps=z.useRef(me);z.useEffect(()=>{ps.current!==me&&(ps.current=me,le(me),X(me))},[me]),z.useEffect(()=>{me||Kn({railCollapsed:F,rightCollapsed:ae})},[F,ae,me]),z.useEffect(()=>{Kn({rightTab:O})},[O]);const _s=je.record,Qs=e.activeSessionId,ei=w!=null&&Ll(((uc=e.state)==null?void 0:uc.sessions)??[],w).length>0,Ks=z.useRef(!1);z.useEffect(()=>{if(Ks.current){Ks.current=!1;return}W?_s({kind:"templates"}):J?_s({kind:"review",summary:J}):d?_s({kind:"composer"}):Qs&&(w==null||ei)?_s({kind:"session",sessionId:Qs,agentPath:w}):w&&_s({kind:"agent",agentPath:w})},[_s,W,J,d,Qs,w,ei]);const $s=e.setActiveSessionId,gi=z.useCallback(Z=>{Z&&(Ks.current=!0,I(!1),Q(Z.kind==="templates"),m(Z.kind==="composer"),ee(Z.kind==="review"?Z.summary:null),Z.kind==="session"?(R(Z.agentPath),$s(Z.sessionId)):Z.kind==="agent"&&R(Z.agentPath))},[$s]),ds=((Ro=e.state)==null?void 0:Ro.sessions.find(Z=>Z.id===e.activeSessionId&&Z.status==="exited"))??null,Ls=ds!=null&&ds.agentSessionId?(To=e.history.find(Z=>Z.agentSessionId===ds.agentSessionId))==null?void 0:To.resumeMode:"rehydrate",_i=(ds==null?void 0:ds.agentSessionId)!=null&&Ls===void 0?ds.cwd:null,ys=e.loadHistory;z.useEffect(()=>{_i&&ys([_i])},[_i,ys]);const Ae=z.useRef(new Map);if(z.useEffect(()=>{for(const Z of e.tasks){if(Z.macroId!=="describe")continue;Ae.current.get(Z.id)==="running"&&Z.status!=="running"&&e.showToast(Z.status==="failed"?"Couldn't generate descriptions — check the agent terminal for details.":"Describe run finished — the canvas updates if the agent changed the source.",Z.status==="failed"?"error":"success"),Ae.current.set(Z.id,Z.status)}},[e.tasks,e.showToast]),z.useEffect(()=>{const Z=Xn();if(Z!=null&&Z.onDeepLink)return Z.onDeepLink(Se=>{var Ne;return(Ne=x.current)==null?void 0:Ne.call(x,Se)})},[]),z.useEffect(()=>{var Se;if(e.loading)return;const Z=b.current;!Z||p.current||(p.current=!0,(Se=x.current)==null||Se.call(x,Z))},[e.loading]),z.useEffect(()=>{var Se;const Z=_.current;Z&&((Se=g.current)!=null&&Se.call(g,Z))&&(_.current=null)},[(pa=e.state)==null?void 0:pa.workflows]),e.loading)return h.jsx("div",{className:"app-status",children:"Loading Agent Studio…"});if(e.error||!e.state){const Z=f6({online:t,error:e.errorKind});return h.jsx(C5,{status:Z==="online"?"error":Z,onRetry:e.reload,detail:e.error,onStartAuth:Z==="auth"?e.startAuth:void 0})}const{state:Pe}=e,Qe=Pe.sessions.find(Z=>Z.id===e.activeSessionId)??null,Ms=ra(Qe),Is=Pe.workflows.find(Z=>Z.path===Ms)??null,Cs=Pe.workflows.find(Z=>Z.path===w)??null,sn=Ll(Pe.sessions,w),Di=J!=null,li=!Di&&(Qe==null?void 0:Qe.status)==="exited",oe=!Di&&!li&&!d&&Cs!=null&&sn.length===0,fe=!Di&&!li&&!d&&!oe&&Qe!=null&&Qe.status!=="exited",ye=!Di&&!li&&(d||!oe&&!fe),xe=d&&Qe!=null&&Qe.status!=="exited",Te=oe?null:Is,ct=oe?(Cs==null?void 0:Cs.name)??null:null,xt=`${e.activeSessionId??""}::${(Te==null?void 0:Te.path)??""}`,Dt=()=>{Qt.current=e.activeSessionId??null,Mt.current=e.activeSessionId==null,X(!1)},Rt=Te?wo(Te,e.lastDeployErrorFor(Te.path)):null,Ct=e.activeSessionId?e.runsBySession.get(e.activeSessionId)??null:null,ve=Iw(Ct,Ms)?Ct:null,$e=e.activeSessionId?(e.runIdsBySession.get(e.activeSessionId)??[]).map(Z=>e.runsByExecution.get(Z)).filter(Z=>Z!==void 0).filter(Z=>Iw(Z,Ms)):[],Be=(ve==null?void 0:ve.run.status)==="running"?ve.target:null,Fe=()=>{me&&le(!0)},Ke=async(Z,Se,Ne={})=>{Ne.keepComposerOpen||m(!1),ee(null),I(!1),R(Z),e.addPendingWorkspace(Z),Fe();try{const ze=await e.createSession({cwd:Z,harness:Se});return rc("session.created"),Os("session.started",{harness_kind:Se,origin:"user"}),ze}catch(ze){throw e.removePendingWorkspace(Z),ze}},es=async(Z,Se)=>{await Ke(Z,Se)},Ye=(Z,Se,Ne)=>{const ze=`Scaffold a new Sapiom agent project in this directory: ${Ov(Se,"default")}, then run npm install, read AGENTS.md, and use the sapiom-agent-authoring skill to`,Et=Ne==null?void 0:Ne.trim();Y(Z.id,Et?`${ze} build this:
493
+
494
+ ${Et}`:`${ze} define the first agent.`,"Couldn't send the scaffold prompt. Ask the coding agent to call sapiom_dev_agents_scaffold.")},ts=async(Z,Se,Ne)=>{const ze=await Ke(Z,Se);Ye(ze,Z,Ne)},et=Z=>{var Et;if(S.current)return;S.current=!0,v(!0);const Se=w,Ne=ra(Z),ze=Ne?((Et=Pe.workflows.find(ms=>Nv(ms.path,Ne)))==null?void 0:Et.name)??Gn(Ne):null;(async()=>{try{const ms=await Ke(Z.cwd,Z.harness);if(!Ne){R(Z.cwd);return}try{await e.bindWorkflow(ms.id,Ne),R(Ne)}catch{R(Z.cwd),e.showToast(`Session started, but couldn't attach it to ${ze??"the agent"}.`)}}catch{R(Se??Ne??Z.cwd),e.setActiveSessionId(Z.id),e.showToast("Couldn't start the session.")}finally{S.current=!1,v(!1)}})()},dt=Z=>{(async()=>{const Se=Ll(Pe.sessions,Z.path)[0],Ne=(Se==null?void 0:Se.cwd)??Z.path;try{const ze=await Ke(Ne,"claude-code");await e.bindWorkflow(ze.id,Z.path),R(Z.path)}catch(ze){e.showToast(ze.message||"Couldn't start the session.")}})()},It=Z=>{var Ne;const Se=((Ne=Pe.sessions.find(ze=>ze.id===Z))==null?void 0:Ne.cwd)??".";Y(Z,`Scaffold a new Sapiom agent project in this directory: ${Ov(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.")},Ys=async(Z,Se,Ne="template_gallery")=>{const ze=await Ke(Z,"claude-code");Os("agent.template_cloned",{template_slug:Se.id,template_id:Se.id,surface:Ne}),Y(ze.id,p5(Se,Z),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.")},nn=Z=>{const Se=new Set;for(const Ne of Pe.sessions){const ze=Gn(Ne.cwd);ze&&Se.add(ze)}for(const Ne of Pe.workflows){const ze=Gn(Ne.path);ze&&Se.add(ze)}return XC(u5(Z,Se),Lt||null)},pn=async(Z,Se,Ne)=>{const ze=nn(Z.trim()?o5(Z):vg);if(!ze)throw new Error("Set a project folder first — use the + to open one.");X(!0);const Et=await Ke(ze,Se,{keepComposerOpen:!0});try{const ms=await C$(Et.id,Ne,e.attachFile);Ye(Et,ze,E$(Z,ms)),m(!1)}catch(ms){throw await e.closeSession(Et.id).catch(Es=>{console.error("[harness] attachment rollback failed:",Es)}),e.removePendingWorkspace(ze),ms}},ua=Z=>{const Se=nn(Z.id);if(!Se){e.showToast("Set a project folder first — use the + to open one.");return}X(!0),Ys(Se,Z,"welcome")},yi=async Z=>{const Se=await e.scanWorkflows(Z);return e.showToast(Se.length===0?"No agent projects found under this folder.":Se.length===1?"Found 1 agent project.":`Found ${Se.length} agent projects.`,Se.length===0?"info":"success"),Se.length},ti=Z=>{m(!1),ee(null),Q(!1),I(!1),Fe();const Se=Pe.sessions.find(Ne=>Ne.id===Z);Se&&R(ra(Se)??Se.cwd),e.setActiveSessionId(Z)},oc=Z=>{m(!1),ee(null),Q(!1),I(!1),e.setActiveSessionId(Z)},lc=Z=>{m(!1),ee(Z),Q(!1),I(!1),Fe()},Co=Z=>{var Ne;const Se=(Ne=e.settings)==null?void 0:Ne.editor;e.showToast(`Opening in ${Dw(Se)}… Pick a different editor in Settings.`,"info"),window.location.href=J$(Se,Z)},Eo=Z=>{var ze;m(!1),ee(null),Q(!1),I(!1),R(Z),Fe();const Se=Ll(Pe.sessions,Z),Ne=Se.some(Et=>Et.id===e.activeSessionId)?e.activeSessionId:((ze=Se[Se.length-1])==null?void 0:ze.id)??null;Ne!==e.activeSessionId&&e.setActiveSessionId(Ne)};g.current=Z=>{const Se=Pe.workflows.find(Ne=>Ne.definitionId!=null&&String(Ne.definitionId)===Z);return Se?(Eo(Se.path),!0):!1},x.current=Z=>{var Se;if(Z.kind==="template"){N(Z.templateId),Q(!0),I(!1);return}(Se=g.current)!=null&&Se.call(g,Z.definitionId)||A(Z)};const da=async Z=>{var Ne;A(null);const Se=nn(((Ne=Z.slug)==null?void 0:Ne.trim())||`agent-${Z.definitionId}`);if(!Se){e.showToast("Set a project folder first — use the + to open one.");return}_.current=Z.definitionId,X(!0);try{const ze=await Ke(Se,"claude-code");Y(ze.id,m5(Z.definitionId,Se),"Couldn't send the clone prompt. Ask the coding agent to run sapiom_dev_agents_clone.")}catch(ze){_.current=null,e.showToast(ze.message||"Couldn't start a session to clone the agent.")}},ha=async Z=>{Fe();const Se=Pe.sessions.filter(Es=>Es.status!=="exited"),Ne=Es=>Es.boundWorkflowPath===Z||mg(Es.cwd,Z),ze=Se.find(Es=>Es.id===e.activeSessionId),Et=ze&&Ne(ze)?ze:Se.filter(Ne).sort((Es,kr)=>kr.cwd.length-Es.cwd.length||kr.createdAt.localeCompare(Es.createdAt))[0];let ms;if(Et)m(!1),ee(null),I(!1),Et.id!==e.activeSessionId&&e.setActiveSessionId(Et.id),ms=Et.id;else try{ms=(await Ke(Z,"claude-code")).id}catch(Es){return e.showToast(Es.message||"Couldn't start a session in this folder."),null}return await e.bindWorkflow(ms,Z),R(Z),ms},si=(Z,Se)=>{(async()=>{const Ne=n2(Se.id);((Ne==="deploy"||Ne==="run-local")&&Z!=null||Ne==="prod-run"&&(Z==null?void 0:Z.definitionId)!=null&&zd(Z))&&(B("steps"),X(!1));let Et=e.activeSessionId;if(Z&&(Et=await ha(Z.path)??Et),Se.action.kind==="open-url"){window.open(V5(Se.action.url,Z),"_blank","noopener,noreferrer");return}if(Et){if(Ne!==null){if(Ne==="deploy")Z?e.deploy(Z.path):e.showToast("Select an agent first.");else if(Ne==="prod-run")if((Z==null?void 0:Z.definitionId)!=null&&zd(Z))e.startProdRun(Et,String(Z.definitionId));else{const ms=Z?e.lastDeployErrorFor(Z.path):null,Es=Z?wo(Z,ms):"draft";e.showToast(Es==="failed"?"Last deploy failed — retry Deploy.":Es==="building"?"The cloud build is still in progress.":Es==="linked"?"No ready deployment yet — deploy it first.":"This agent isn't deployed yet — deploy it first.")}else Ne==="run-local"&&(Z?e.runLocal(Et,Z.path):e.showToast("Select an agent first."));return}e.runMacro(Se.id,{harnessSessionId:Et,workflowPath:Z==null?void 0:Z.path})}})()},ko=Z=>{const Se=o;Se&&(c(null),B("steps"),X(!1),(async()=>{const Ne=await ha(Se.workflow.path)??e.activeSessionId;if(Ne)if(Se.target==="prod"){if(Se.workflow.definitionId==null||!zd(Se.workflow)){e.showToast("This agent needs a ready cloud deployment first.");return}await e.startProdRun(Ne,String(Se.workflow.definitionId),Z)}else await e.runLocal(Ne,Se.workflow.path,Z)})())},cc=Z=>{(async()=>{const Se=await ha(Z.path)??e.activeSessionId;Se&&e.runMacro("describe",{harnessSessionId:Se,workflowPath:Z.path,subject:L6(Z)})})()};return h.jsxs("div",{className:"app-shell","data-rail-collapsed":F||void 0,children:[me&&!F&&h.jsx("div",{className:"shell-scrim","data-testid":"rail-drawer-scrim","aria-hidden":"true",onClick:()=>le(!0)}),(!me||!F)&&h.jsx("div",{className:"rail-slot"+(at?" is-resizing":"")+(!me&&F?" is-collapsed":""),inert:!me&&F?!0:void 0,style:me?void 0:{width:F?0:Oe.rail},children:h.jsx(l6,{projectRoot:Lt||null,onSaveProjectRoot:Ns,width:Oe.rail,minWidth:Ag,workflows:Pe.workflows,sessions:Pe.sessions,pendingWorkspaces:e.pendingWorkspaces,activeSessionId:e.activeSessionId,focusedAgentPath:w,onFocusAgent:Eo,onOpenPalette:()=>r(!0),onConnect:async Z=>{await e.connectWorkflow(Z)},onCollapse:()=>le(!0),canGoBack:je.canGoBack,canGoForward:je.canGoForward,onGoBack:()=>gi(je.goBack()),onGoForward:()=>gi(je.goForward()),onSelectSession:ti,overviewSelected:ie,onSelectOverview:()=>{I(!0),m(!1),ee(null),Q(!1),Fe()},onNewSession:()=>{m(!0),Q(!1),I(!1)},onReviewSummary:lc,history:e.history,historyLoading:e.historyLoading,onOpenHistory:Z=>void e.loadHistory(Z),recentDirs:((dc=e.settings)==null?void 0:dc.recentDirs)??[],launchDir:Pe.launchDir??null,listDir:e.listDir,onCreateSession:es,listHarnesses:e.listHarnesses,onScaffoldSession:ts,onScaffoldInSession:It,onBrowseTemplates:()=>{Q(!0),I(!1)},templatesActive:W,onScanWorkflows:yi,onToast:e.showToast,telemetryOptIn:((hc=e.settings)==null?void 0:hc.telemetryOptIn)??Pe.telemetryOptIn,consentSource:Pe.consentSource,consentEnvReason:Pe.consentEnvReason,authenticated:Pe.authenticated,organizationName:Pe.organizationName,onToggleTelemetry:async Z=>{await e.updateSettings({telemetryOptIn:Z})},productAnalyticsOptIn:Pe.productAnalyticsOptIn,onToggleProductAnalytics:async Z=>{await e.updateSettings({productAnalyticsOptIn:Z})},rollingSummary:((Er=e.settings)==null?void 0:Er.rollingSummary)===!0,onToggleRollingSummary:async Z=>{await e.updateSettings({rollingSummary:Z})},editor:$h((Oi=e.settings)==null?void 0:Oi.editor),onSelectEditor:async Z=>{await e.updateSettings({editor:Z})},onStartAuth:e.startAuth,onDisconnect:e.disconnect,settingsOpen:j,onSetSettingsOpen:M})}),!F&&!me&&h.jsx("div",{className:"pane-resize-handle pane-resize-handle-rail",style:{left:Oe.rail},onPointerDown:Ee,onDoubleClick:We,role:"separator","aria-orientation":"vertical","aria-label":"Resize workspace rail","data-testid":"resize-handle-rail"}),h.jsxs("div",{className:"workspace-main",children:[!t&&h.jsx(E5,{}),Pe.consentSource==="default-silent"&&!((ma=e.settings)!=null&&ma.telemetryNoticeDismissed)&&h.jsx(TO,{onDismiss:()=>{e.updateSettings({telemetryNoticeDismissed:!0})},onOpenSettings:()=>M(!0)}),h.jsxs("div",{className:"app"+(W?" is-browsing":"")+(!W&&!me&&!ye?" canvas-animated":"")+(Ze?" canvas-sliding":"")+(Le?" canvas-dragging":""),style:{gridTemplateColumns:W||me||ye?"minmax(0, 1fr)":`minmax(${ac}px, 1fr) ${ae?Oe.canvas==null?"0fr":"0px":Oe.canvas==null?"1fr":`${Oe.canvas}px`}`},children:[W&&h.jsx(FO,{projectRoot:Lt||null,recentDirs:((va=e.settings)==null?void 0:va.recentDirs)??[],listDir:e.listDir,onExit:()=>Q(!1),onUse:Ys,listTemplates:e.listTemplates,getTemplate:e.getTemplate,openTemplateId:C}),h.jsxs("div",{className:"center-pane",children:[h.jsx(U5,{openedAgentName:ct,reviewTitle:J?J.title:null,composing:ye,onBack:xe?()=>m(!1):null,activeSession:fe||li?Qe:null,sessionName:Qe?mh(Qe,Pe.sessions,P):null,onRenameSession:H,boundWorkflowName:(Is==null?void 0:Is.name)??null,sessions:fe?sn:[],busySessionIds:e.busySessionIds,onSelectSession:oc,labelOf:Z=>mh(Z,Pe.sessions,P),busy:Qe!=null&&e.busySessionIds.has(Qe.id),onCloseSession:Z=>void e.closeSession(Z),onOpenInEditor:Co,editorLabel:Dw((gn=e.settings)==null?void 0:gn.editor),onToast:e.showToast,onExpandRail:F?()=>le(!1):null,onExpandRight:ae?Dt:null,subjectName:(Cs==null?void 0:Cs.name)??(Qe?Gn(Qe.cwd):null),newSessionPending:y,onNewSession:Qe?()=>et(Qe):null,actions:fe&&Qe&&Is?h.jsx(CO,{workflow:Is,activeSessionId:e.activeSessionId,sessionReady:Qe.ready===!0&&Qe.status!=="exited",macros:Pe.macros,onRunMacro:Z=>si(Is,Z),onRequestRun:(Z,Se)=>c({workflow:Is,target:Z,returnFocus:Se}),preview:e.previewBySession.get(Qe.id)??null,lastDeployError:e.lastDeployErrorFor(Is.path),authenticated:Pe.authenticated,directActionSettleSeq:e.directActionSettleSeq,runningTarget:Be}):null}),h.jsx("div",{className:"terminal-slot",children:Di&&J?h.jsx(P5,{summary:J,loadRecord:e.sessionRecord,onStart:()=>{const Z=J;ee(null),e.resumeFromHistory(Z)},onClose:()=>ee(null)}):li&&Qe?h.jsx(I5,{session:Qe,resumeMode:Ls,loadRecord:e.sessionRecord,onResume:()=>void e.resumeSession(Qe.id),onContinue:()=>void e.rehydrateSession({cwd:Qe.cwd,harness:Qe.harness,from:Qe.id}),onClose:()=>void e.closeSession(Qe.id)}):oe&&Cs?h.jsx(Zi,{className:"terminal-empty",testId:"open-agent-empty",icon:"Radio",title:`No running session for ${Cs.name}`,body:"Start a session to map, run, and inspect this agent.",cta:h.jsxs("button",{className:"btn-primary","data-testid":"open-agent-start-session",onClick:()=>dt(Cs),children:[h.jsx(de,{name:"Plus",size:14})," Start session"]})}):fe&&e.activeSessionId?h.jsx("div",{className:"agent-view","data-testid":"agent-view",children:h.jsx("div",{className:"agent-view-panel",id:"agent-panel-terminal",children:h.jsx(a$,{sessionId:e.activeSessionId,token:e.bootToken,cwd:(Qe==null?void 0:Qe.cwd)??null})})}):h.jsx(P$,{firstRun:Pe.firstRun===!0,onSubmitIdea:pn,onAttachmentError:e.showToast,onUseTemplate:ua,onBrowseTemplates:()=>Q(!0),listHarnesses:e.listHarnesses,listTemplates:e.listTemplates,telemetryOptIn:((_n=e.settings)==null?void 0:_n.telemetryOptIn)??Pe.telemetryOptIn,onToggleTelemetry:async Z=>{await e.updateSettings({telemetryOptIn:Z})},recentDirs:((No=e.settings)==null?void 0:No.recentDirs)??[],projectRoot:Lt||null,listDir:e.listDir,onConnect:async Z=>{await e.connectWorkflow(Z)},onScan:yi,onScaffold:ts,onSaveProjectRoot:Ns})})]}),!ae&&!me&&!ye&&h.jsx("div",{className:"pane-resize-handle pane-resize-handle-canvas",style:{right:Oe.canvas==null?"50%":`min(${Oe.canvas}px, calc(100% - ${ac}px))`},onPointerDown:qe,onDoubleClick:it,role:"separator","aria-orientation":"vertical","aria-label":"Resize canvas pane","data-testid":"resize-handle-canvas"}),me&&!ae&&h.jsx("div",{className:"shell-scrim","data-testid":"right-sheet-scrim","aria-hidden":"true",onClick:()=>X(!0)}),h.jsxs("div",{ref:xs,className:"right-pane"+(ae||ye?" is-collapsed":""),children:[h.jsxs("div",{className:"right-pane-tabs",role:"tablist","aria-label":"Right pane",children:[h.jsxs("button",{role:"tab","aria-selected":O==="canvas",className:"right-pane-tab"+(O==="canvas"?" is-active":""),onClick:()=>B("canvas"),"data-testid":"right-tab-canvas",children:[h.jsx(de,{name:"Workflow",size:14}),"Canvas"]}),h.jsxs("button",{role:"tab","aria-selected":O==="steps",className:"right-pane-tab"+(O==="steps"?" is-active":""),onClick:()=>B("steps"),"data-testid":"right-tab-steps",children:[h.jsx(de,{name:"List",size:14}),"Steps"]}),h.jsxs("button",{role:"tab","aria-selected":O==="code",className:"right-pane-tab"+(O==="code"?" is-active":""),onClick:()=>{B("code"),V(!0)},"data-testid":"right-tab-code",children:[h.jsx(de,{name:"Code",size:14}),"Code"]}),h.jsxs("div",{className:"right-pane-corner",children:[O==="canvas"&&(Te==null?void 0:Te.definitionId)!=null&&h.jsxs("a",{className:"status-tag status-tag-action workflow-deployed-tag right-pane-deployed","data-testid":"workflow-dashboard-link","data-deployment-state":Rt??void 0,href:xh(Te.definitionId),target:"_blank",rel:"noreferrer","aria-label":`${Rt} — open in the Sapiom dashboard`,"data-tooltip":"Open this agent in the Sapiom dashboard",children:[h.jsx(de,{name:"Cloud",size:12}),Rt==="ready"?"deployed":Rt==="building"?"building":Rt==="failed"?"deploy failed":"linked"]}),(O==="canvas"||O==="steps")&&h.jsx("button",{className:"theme-toggle","data-testid":"canvas-expand",hidden:te,"aria-label":O==="steps"?"Open Focus mode":"Expand canvas",title:O==="steps"?"Open Focus mode":"Expand canvas",onClick:()=>ue(Z=>!Z),children:h.jsx(de,{name:"Maximize2",size:15})}),h.jsx("button",{className:"theme-toggle right-pane-collapse","data-testid":"right-collapse","aria-label":"Collapse canvas panel",title:"Collapse canvas panel",onClick:()=>X(!0),children:h.jsx(de,{name:"PanelRightClose",size:15})})]})]}),h.jsx("div",{className:"right-pane-panel"+(O==="canvas"||O==="steps"?"":" is-hidden"),"data-testid":"right-panel-canvas",children:h.jsx(v4,{sessionId:e.activeSessionId,lastMessage:e.lastMessage,boundWorkflow:Te,noSessionAgent:ct,overviewActive:ye,sessionExited:li,onCanvasState:Z=>{var ze;if(me)return;const Se=((ze=Pe.sessions.find(Et=>Et.id===e.activeSessionId))==null?void 0:ze.status)==="exited";if(Z||Se){mt.current=null,X(!1);return}if(Mt.current){Mt.current=!1,Qt.current=e.activeSessionId??null;return}const Ne=Qt.current;Ne!=null&&Ne===e.activeSessionId||mt.current!==xt&&(mt.current=xt,X(!0))},onGraphChange:(Z,Se)=>{const Ne=bO(Se);Ne&&f.current.set(Z,Ne)},expanded:te,onToggleExpanded:()=>ue(Z=>!Z),macros:Pe.macros,tasks:e.tasks,surface:O==="steps"?"steps":"board",onOpenSteps:()=>B("steps"),run:(ve==null?void 0:ve.run)??null,runTarget:(ve==null?void 0:ve.target)??null,runs:$e,onSelectRun:Z=>{e.activeSessionId&&e.selectRun(e.activeSessionId,Z)},preview:e.activeSessionId?e.previewBySession.get(e.activeSessionId)??null:null,deployState:Te?e.deployStateByPath.get(Te.path)??null:null,onDismissDeploy:()=>{Te&&e.dismissDeployState(Te.path)},onOpenCode:()=>{B("code"),V(!0)},workflows:Pe.workflows,onOpenWorkflow:Z=>void ha(Z),onRunMacro:Z=>si(Is,Z),onInjectPrompt:Z=>{e.activeSessionId&&e.injectInput(e.activeSessionId,Z)},onDescribeWorkflow:cc})}),(O==="code"||q)&&h.jsx("div",{className:"right-pane-panel"+(O==="code"?"":" is-hidden"),"data-testid":"right-panel-code",children:h.jsx(N4,{boundWorkflow:Te,noSessionAgent:ct,agentsBaseUrl:Pe.agentsBaseUrl,lastDeployError:Te?e.lastDeployErrorFor(Te.path):null})})]})]})]}),ie&&h.jsx(B$,{firstRun:Pe.firstRun===!0,appVersion:((ga=Xn())==null?void 0:ga.appVersion)||"0.8.8",recentDirs:((Mo=e.settings)==null?void 0:Mo.recentDirs)??[],projectRoot:Lt||null,listDir:e.listDir,onConnect:async Z=>{await e.connectWorkflow(Z),I(!1)},onScan:yi,onBrowseTemplates:()=>{I(!1),Q(!0)},onDismiss:()=>I(!1)}),i&&h.jsx(w5,{sessions:Pe.sessions,workflows:Pe.workflows,recentDirs:((Jn=e.settings)==null?void 0:Jn.recentDirs)??[],history:e.history,sessionNames:P,activeSessionId:e.activeSessionId,listDir:e.listDir,listTemplates:e.listTemplates,onSelectSession:ti,onReviewSummary:lc,onOpenPath:Z=>void es(Z,"claude-code"),onOpenTemplate:Z=>{N(Z),Q(!0),I(!1)},actions:[{id:"browse-templates",label:"Browse templates",meta:"Gallery and starters",icon:"LayoutTemplate",run:()=>{Q(!0),I(!1)}},{id:"toggle-theme",label:"Toggle theme",meta:"Light and dark",icon:"Sun",run:Ww},{id:"toggle-rail",label:F?"Show workspace panel":"Hide workspace panel",meta:"Left pane",icon:"Menu",run:()=>le(Z=>!Z)},{id:"toggle-right",label:ae?"Show canvas panel":"Hide canvas panel",meta:"Right pane",icon:ae?"PanelRightOpen":"PanelRightClose",run:()=>X(Z=>!Z)},...Qe?[{id:"new-session-here",label:"New session in this folder",meta:Qe.cwd,icon:"Plus",run:()=>void es(Qe.cwd,"claude-code")}]:[]],onClose:()=>r(!1)}),k&&h.jsx(v6,{agentLabel:k.slug?`“${k.slug}”`:`Agent ${k.definitionId}`,onCancel:()=>A(null),onConfirm:()=>void da(k)}),o&&h.jsx(RO,{workflow:o.workflow,target:o.target,loadContract:l,returnFocus:o.returnFocus,onClose:()=>c(null),onRun:ko}),e.toast&&h.jsx(u$,{message:e.toast.message,tone:e.toast.tone,onDismiss:e.dismissToast}),h.jsx(d$,{})]})};function pL(e=document.documentElement,t=window){const i=c=>{e.dataset.windowFocused=c?"true":"false"};i(t.document.hasFocus());const r=()=>i(!0),o=()=>i(!1);return t.addEventListener("focus",r),t.addEventListener("blur",o),()=>{t.removeEventListener("focus",r),t.removeEventListener("blur",o)}}function mL(e=typeof window>"u"?"":window.location.search){return new URLSearchParams(e).get("frame")==="macos"?"macos":"web"}document.documentElement.dataset.windowFrame=mL();pL();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()});eA.createRoot(document.getElementById("root")).render(h.jsx(z.StrictMode,{children:h.jsx(fL,{})}));