@sapiom/harness 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/core/adapters/claude-code.d.ts +15 -18
- package/dist/core/adapters/claude-code.d.ts.map +1 -1
- package/dist/core/adapters/claude-code.js +26 -20
- package/dist/core/adapters/claude-code.js.map +1 -1
- package/dist/server/rest.d.ts.map +1 -1
- package/dist/server/rest.js +106 -1
- package/dist/server/rest.js.map +1 -1
- package/dist/shared/types.d.ts +21 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/shared/types.js +7 -0
- package/dist/shared/types.js.map +1 -1
- package/dist/web/assets/{index-C3nbT8wm.css → index-BuY7sGHa.css} +1 -1
- package/dist/web/assets/index-Cp2L9smf.js +494 -0
- package/dist/web/index.html +2 -2
- package/package.json +4 -4
- package/dist/web/assets/index-DlI78kCp.js +0 -490
|
@@ -1,490 +0,0 @@
|
|
|
1
|
-
var Pk=Object.defineProperty;var Bk=(e,t,n)=>t in e?Pk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Mp=(e,t,n)=>Bk(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const f of c.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&r(f)}).observe(document,{childList:!0,subtree:!0});function n(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(o){if(o.ep)return;o.ep=!0;const c=n(o);fetch(o.href,c)}})();function Hk(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Op={exports:{}},fl={};/**
|
|
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 eb;function zk(){if(eb)return fl;eb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(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 fl.Fragment=t,fl.jsx=n,fl.jsxs=n,fl}var tb;function Uk(){return tb||(tb=1,Op.exports=zk()),Op.exports}var h=Uk(),Dp={exports:{}},rt={};/**
|
|
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 sb;function qk(){if(sb)return rt;sb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),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(O){return O===null||typeof O!="object"?null:(O=S&&O[S]||O["@@iterator"],typeof O=="function"?O:null)}var R={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,g={};function b(O,P,z){this.props=O,this.context=P,this.refs=g,this.updater=z||R}b.prototype.isReactComponent={},b.prototype.setState=function(O,P){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,P,"setState")},b.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function p(){}p.prototype=b.prototype;function _(O,P,z){this.props=O,this.context=P,this.refs=g,this.updater=z||R}var k=_.prototype=new p;k.constructor=_,x(k,b.prototype),k.isPureReactComponent=!0;var j=Array.isArray;function C(){}var T={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function M(O,P,z){var I=z.ref;return{$$typeof:e,type:O,key:P,ref:I!==void 0?I:null,props:z}}function L(O,P){return M(O.type,P,O.props)}function B(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function q(O){var P={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(z){return P[z]})}var F=/\/+/g;function J(O,P){return typeof O=="object"&&O!==null&&O.key!=null?q(""+O.key):P.toString(36)}function te(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(C,C):(O.status="pending",O.then(function(P){O.status==="pending"&&(O.status="fulfilled",O.value=P)},function(P){O.status==="pending"&&(O.status="rejected",O.reason=P)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function W(O,P,z,I,G){var ie=typeof O;(ie==="undefined"||ie==="boolean")&&(O=null);var X=!1;if(O===null)X=!0;else switch(ie){case"bigint":case"string":case"number":X=!0;break;case"object":switch(O.$$typeof){case e:case t:X=!0;break;case y:return X=O._init,W(X(O._payload),P,z,I,G)}}if(X)return G=G(O),X=I===""?"."+J(O,0):I,j(G)?(z="",X!=null&&(z=X.replace(F,"$&/")+"/"),W(G,P,z,"",function(ae){return ae})):G!=null&&(B(G)&&(G=L(G,z+(G.key==null||O&&O.key===G.key?"":(""+G.key).replace(F,"$&/")+"/")+X)),P.push(G)),1;X=0;var V=I===""?".":I+":";if(j(O))for(var ce=0;ce<O.length;ce++)I=O[ce],ie=V+J(I,ce),X+=W(I,P,z,ie,G);else if(ce=w(O),typeof ce=="function")for(O=ce.call(O),ce=0;!(I=O.next()).done;)I=I.value,ie=V+J(I,ce++),X+=W(I,P,z,ie,G);else if(ie==="object"){if(typeof O.then=="function")return W(te(O),P,z,I,G);throw P=String(O),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return X}function se(O,P,z){if(O==null)return O;var I=[],G=0;return W(O,I,"","",function(ie){return P.call(z,ie,G++)}),I}function ee(O){if(O._status===-1){var P=O._result;P=P(),P.then(function(z){(O._status===0||O._status===-1)&&(O._status=1,O._result=z)},function(z){(O._status===0||O._status===-1)&&(O._status=2,O._result=z)}),O._status===-1&&(O._status=0,O._result=P)}if(O._status===1)return O._result.default;throw O._result}var H=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var P=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},$={map:se,forEach:function(O,P,z){se(O,function(){P.apply(this,arguments)},z)},count:function(O){var P=0;return se(O,function(){P++}),P},toArray:function(O){return se(O,function(P){return P})||[]},only:function(O){if(!B(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return rt.Activity=v,rt.Children=$,rt.Component=b,rt.Fragment=n,rt.Profiler=o,rt.PureComponent=_,rt.StrictMode=r,rt.Suspense=d,rt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,rt.__COMPILER_RUNTIME={__proto__:null,c:function(O){return T.H.useMemoCache(O)}},rt.cache=function(O){return function(){return O.apply(null,arguments)}},rt.cacheSignal=function(){return null},rt.cloneElement=function(O,P,z){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var I=x({},O.props),G=O.key;if(P!=null)for(ie in P.key!==void 0&&(G=""+P.key),P)!A.call(P,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&P.ref===void 0||(I[ie]=P[ie]);var ie=arguments.length-2;if(ie===1)I.children=z;else if(1<ie){for(var X=Array(ie),V=0;V<ie;V++)X[V]=arguments[V+2];I.children=X}return M(O.type,G,I)},rt.createContext=function(O){return O={$$typeof:f,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:c,_context:O},O},rt.createElement=function(O,P,z){var I,G={},ie=null;if(P!=null)for(I in P.key!==void 0&&(ie=""+P.key),P)A.call(P,I)&&I!=="key"&&I!=="__self"&&I!=="__source"&&(G[I]=P[I]);var X=arguments.length-2;if(X===1)G.children=z;else if(1<X){for(var V=Array(X),ce=0;ce<X;ce++)V[ce]=arguments[ce+2];G.children=V}if(O&&O.defaultProps)for(I in X=O.defaultProps,X)G[I]===void 0&&(G[I]=X[I]);return M(O,ie,G)},rt.createRef=function(){return{current:null}},rt.forwardRef=function(O){return{$$typeof:l,render:O}},rt.isValidElement=B,rt.lazy=function(O){return{$$typeof:y,_payload:{_status:-1,_result:O},_init:ee}},rt.memo=function(O,P){return{$$typeof:m,type:O,compare:P===void 0?null:P}},rt.startTransition=function(O){var P=T.T,z={};T.T=z;try{var I=O(),G=T.S;G!==null&&G(z,I),typeof I=="object"&&I!==null&&typeof I.then=="function"&&I.then(C,H)}catch(ie){H(ie)}finally{P!==null&&z.types!==null&&(P.types=z.types),T.T=P}},rt.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},rt.use=function(O){return T.H.use(O)},rt.useActionState=function(O,P,z){return T.H.useActionState(O,P,z)},rt.useCallback=function(O,P){return T.H.useCallback(O,P)},rt.useContext=function(O){return T.H.useContext(O)},rt.useDebugValue=function(){},rt.useDeferredValue=function(O,P){return T.H.useDeferredValue(O,P)},rt.useEffect=function(O,P){return T.H.useEffect(O,P)},rt.useEffectEvent=function(O){return T.H.useEffectEvent(O)},rt.useId=function(){return T.H.useId()},rt.useImperativeHandle=function(O,P,z){return T.H.useImperativeHandle(O,P,z)},rt.useInsertionEffect=function(O,P){return T.H.useInsertionEffect(O,P)},rt.useLayoutEffect=function(O,P){return T.H.useLayoutEffect(O,P)},rt.useMemo=function(O,P){return T.H.useMemo(O,P)},rt.useOptimistic=function(O,P){return T.H.useOptimistic(O,P)},rt.useReducer=function(O,P,z){return T.H.useReducer(O,P,z)},rt.useRef=function(O){return T.H.useRef(O)},rt.useState=function(O){return T.H.useState(O)},rt.useSyncExternalStore=function(O,P,z){return T.H.useSyncExternalStore(O,P,z)},rt.useTransition=function(){return T.H.useTransition()},rt.version="19.2.7",rt}var ib;function Pv(){return ib||(ib=1,Dp.exports=qk()),Dp.exports}var U=Pv(),$p={exports:{}},pl={},Lp={exports:{}},Ip={};/**
|
|
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 nb;function Fk(){return nb||(nb=1,(function(e){function t(W,se){var ee=W.length;W.push(se);e:for(;0<ee;){var H=ee-1>>>1,$=W[H];if(0<o($,se))W[H]=se,W[ee]=$,ee=H;else break e}}function n(W){return W.length===0?null:W[0]}function r(W){if(W.length===0)return null;var se=W[0],ee=W.pop();if(ee!==se){W[0]=ee;e:for(var H=0,$=W.length,O=$>>>1;H<O;){var P=2*(H+1)-1,z=W[P],I=P+1,G=W[I];if(0>o(z,ee))I<$&&0>o(G,z)?(W[H]=G,W[I]=ee,H=I):(W[H]=z,W[P]=ee,H=P);else if(I<$&&0>o(G,ee))W[H]=G,W[I]=ee,H=I;else break e}}return se}function o(W,se){var ee=W.sortIndex-se.sortIndex;return ee!==0?ee:W.id-se.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 se=n(m);se!==null;){if(se.callback===null)r(m);else if(se.startTime<=W)r(m),se.sortIndex=se.expirationTime,t(d,se);else break;se=n(m)}}function j(W){if(x=!1,k(W),!R)if(n(d)!==null)R=!0,C||(C=!0,q());else{var se=n(m);se!==null&&te(j,se.startTime-W)}}var C=!1,T=-1,A=5,M=-1;function L(){return g?!0:!(e.unstable_now()-M<A)}function B(){if(g=!1,C){var W=e.unstable_now();M=W;var se=!0;try{e:{R=!1,x&&(x=!1,p(T),T=-1),w=!0;var ee=S;try{t:{for(k(W),v=n(d);v!==null&&!(v.expirationTime>W&&L());){var H=v.callback;if(typeof H=="function"){v.callback=null,S=v.priorityLevel;var $=H(v.expirationTime<=W);if(W=e.unstable_now(),typeof $=="function"){v.callback=$,k(W),se=!0;break t}v===n(d)&&r(d),k(W)}else r(d);v=n(d)}if(v!==null)se=!0;else{var O=n(m);O!==null&&te(j,O.startTime-W),se=!1}}break e}finally{v=null,S=ee,w=!1}se=void 0}}finally{se?q():C=!1}}}var q;if(typeof _=="function")q=function(){_(B)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,J=F.port2;F.port1.onmessage=B,q=function(){J.postMessage(null)}}else q=function(){b(B,0)};function te(W,se){T=b(function(){W(e.unstable_now())},se)}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"):A=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 se=3;break;default:se=S}var ee=S;S=se;try{return W()}finally{S=ee}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(W,se){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var ee=S;S=W;try{return se()}finally{S=ee}},e.unstable_scheduleCallback=function(W,se,ee){var H=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?H+ee:H):ee=H,W){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=ee+$,W={id:y++,callback:se,priorityLevel:W,startTime:ee,expirationTime:$,sortIndex:-1},ee>H?(W.sortIndex=ee,t(m,W),n(d)===null&&W===n(m)&&(x?(p(T),T=-1):x=!0,te(j,ee-H))):(W.sortIndex=$,t(d,W),R||w||(R=!0,C||(C=!0,q()))),W},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(W){var se=S;return function(){var ee=S;S=se;try{return W.apply(this,arguments)}finally{S=ee}}}})(Ip)),Ip}var rb;function Vk(){return rb||(rb=1,Lp.exports=Fk()),Lp.exports}var Pp={exports:{}},Ys={};/**
|
|
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 ab;function Wk(){if(ab)return Ys;ab=1;var e=Pv();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 n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(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 Ys.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Ys.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)},Ys.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()}},Ys.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))},Ys.prefetchDNS=function(d){typeof d=="string"&&r.d.D(d)},Ys.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})}},Ys.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)},Ys.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})}},Ys.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)},Ys.requestFormReset=function(d){r.d.r(d)},Ys.unstable_batchedUpdates=function(d,m){return d(m)},Ys.useFormState=function(d,m,y){return f.H.useFormState(d,m,y)},Ys.useFormStatus=function(){return f.H.useHostTransitionStatus()},Ys.version="19.2.7",Ys}var ob;function zw(){if(ob)return Pp.exports;ob=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=Wk(),Pp.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 lb;function Gk(){if(lb)return pl;lb=1;var e=Vk(),t=Pv(),n=zw();function r(s){var i="https://react.dev/errors/"+s;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)i+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+s+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function c(s){var i=s,a=s;if(s.alternate)for(;i.return;)i=i.return;else{s=i;do i=s,(i.flags&4098)!==0&&(a=i.return),s=i.return;while(s)}return i.tag===3?a:null}function f(s){if(s.tag===13){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function l(s){if(s.tag===31){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function d(s){if(c(s)!==s)throw Error(r(188))}function m(s){var i=s.alternate;if(!i){if(i=c(s),i===null)throw Error(r(188));return i!==s?null:s}for(var a=s,u=i;;){var E=a.return;if(E===null)break;var N=E.alternate;if(N===null){if(u=E.return,u!==null){a=u;continue}break}if(E.child===N.child){for(N=E.child;N;){if(N===a)return d(E),s;if(N===u)return d(E),i;N=N.sibling}throw Error(r(188))}if(a.return!==u.return)a=E,u=N;else{for(var D=!1,K=E.child;K;){if(K===a){D=!0,a=E,u=N;break}if(K===u){D=!0,u=E,a=N;break}K=K.sibling}if(!D){for(K=N.child;K;){if(K===a){D=!0,a=N,u=E;break}if(K===u){D=!0,u=N,a=E;break}K=K.sibling}if(!D)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:i}function y(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s;for(s=s.child;s!==null;){if(i=y(s),i!==null)return i;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"),j=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),L=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 F=Symbol.for("react.client.reference");function J(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===F?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case x:return"Fragment";case b:return"Profiler";case g:return"StrictMode";case j: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 i=s.render;return s=s.displayName,s||(s=i.displayName||i.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case T:return i=s.displayName||null,i!==null?i:J(s.type)||"Memo";case A:i=s._payload,s=s._init;try{return J(s(i))}catch{}}return null}var te=Array.isArray,W=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},H=[],$=-1;function O(s){return{current:s}}function P(s){0>$||(s.current=H[$],H[$]=null,$--)}function z(s,i){$++,H[$]=s.current,s.current=i}var I=O(null),G=O(null),ie=O(null),X=O(null);function V(s,i){switch(z(ie,i),z(G,s),z(I,null),i.nodeType){case 9:case 11:s=(s=i.documentElement)&&(s=s.namespaceURI)?xy(s):0;break;default:if(s=i.tagName,i=i.namespaceURI)i=xy(i),s=Cy(i,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}P(I),z(I,s)}function ce(){P(I),P(G),P(ie)}function ae(s){s.memoizedState!==null&&z(X,s);var i=I.current,a=Cy(i,s.type);i!==a&&(z(G,s),z(I,a))}function Y(s){G.current===s&&(P(I),P(G)),X.current===s&&(P(X),cl._currentValue=ee)}var Z,ue;function we(s){if(Z===void 0)try{throw Error()}catch(a){var i=a.stack.trim().match(/\n( *(at )?)/);Z=i&&i[1]||"",ue=-1<a.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+Z+s+ue}var Ae=!1;function Ie(s,i){if(!s||Ae)return"";Ae=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(i){var Ee=function(){throw Error()};if(Object.defineProperty(Ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ee,[])}catch(ye){var pe=ye}Reflect.construct(s,[],Ee)}else{try{Ee.call()}catch(ye){pe=ye}s.call(Ee.prototype)}}else{try{throw Error()}catch(ye){pe=ye}(Ee=s())&&typeof Ee.catch=="function"&&Ee.catch(function(){})}}catch(ye){if(ye&&pe&&typeof ye.stack=="string")return[ye.stack,pe.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 N=u.DetermineComponentFrameRoot(),D=N[0],K=N[1];if(D&&K){var ne=D.split(`
|
|
44
|
-
`),fe=K.split(`
|
|
45
|
-
`);for(E=u=0;u<ne.length&&!ne[u].includes("DetermineComponentFrameRoot");)u++;for(;E<fe.length&&!fe[E].includes("DetermineComponentFrameRoot");)E++;if(u===ne.length||E===fe.length)for(u=ne.length-1,E=fe.length-1;1<=u&&0<=E&&ne[u]!==fe[E];)E--;for(;1<=u&&0<=E;u--,E--)if(ne[u]!==fe[E]){if(u!==1||E!==1)do if(u--,E--,0>E||ne[u]!==fe[E]){var xe=`
|
|
46
|
-
`+ne[u].replace(" at new "," at ");return s.displayName&&xe.includes("<anonymous>")&&(xe=xe.replace("<anonymous>",s.displayName)),xe}while(1<=u&&0<=E);break}}}finally{Ae=!1,Error.prepareStackTrace=a}return(a=s?s.displayName||s.name:"")?we(a):""}function $e(s,i){switch(s.tag){case 26:case 27:case 5:return we(s.type);case 16:return we("Lazy");case 13:return s.child!==i&&i!==null?we("Suspense Fallback"):we("Suspense");case 19:return we("SuspenseList");case 0:case 15:return Ie(s.type,!1);case 11:return Ie(s.type.render,!1);case 1:return Ie(s.type,!0);case 31:return we("Activity");default:return""}}function ct(s){try{var i="",a=null;do i+=$e(s,a),a=s,s=s.return;while(s);return i}catch(u){return`
|
|
47
|
-
Error generating stack: `+u.message+`
|
|
48
|
-
`+u.stack}}var ut=Object.prototype.hasOwnProperty,mt=e.unstable_scheduleCallback,et=e.unstable_cancelCallback,vt=e.unstable_shouldYield,tt=e.unstable_requestPaint,Ke=e.unstable_now,Ot=e.unstable_getCurrentPriorityLevel,jt=e.unstable_ImmediatePriority,fs=e.unstable_UserBlockingPriority,Dt=e.unstable_NormalPriority,xt=e.unstable_LowPriority,gs=e.unstable_IdlePriority,It=e.log,gt=e.unstable_setDisableYieldValue,_s=null,Fe=null;function Ts(s){if(typeof It=="function"&>(s),Fe&&typeof Fe.setStrictMode=="function")try{Fe.setStrictMode(_s,s)}catch{}}var ts=Math.clz32?Math.clz32:Gs,vi=Math.log,ps=Math.LN2;function Gs(s){return s>>>=0,s===0?32:31-(vi(s)/ps|0)|0}var ri=256,Zs=262144,ys=4194304;function Ds(s){var i=s&42;if(i!==0)return i;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function ai(s,i,a){var u=s.pendingLanes;if(u===0)return 0;var E=0,N=s.suspendedLanes,D=s.pingedLanes;s=s.warmLanes;var K=u&134217727;return K!==0?(u=K&~N,u!==0?E=Ds(u):(D&=K,D!==0?E=Ds(D):a||(a=K&~s,a!==0&&(E=Ds(a))))):(K=u&~N,K!==0?E=Ds(K):D!==0?E=Ds(D):a||(a=u&~s,a!==0&&(E=Ds(a)))),E===0?0:i!==0&&i!==E&&(i&N)===0&&(N=E&-E,a=i&-i,N>=a||N===32&&(a&4194048)!==0)?i:E}function Is(s,i){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&i)===0}function $s(s,i){switch(s){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function st(){var s=ys;return ys<<=1,(ys&62914560)===0&&(ys=4194304),s}function Ge(s){for(var i=[],a=0;31>a;a++)i.push(s);return i}function ke(s,i){s.pendingLanes|=i,i!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Xe(s,i,a,u,E,N){var D=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,fe=s.hiddenUpdates;for(a=D&~a;0<a;){var xe=31-ts(a),Ee=1<<xe;K[xe]=0,ne[xe]=-1;var pe=fe[xe];if(pe!==null)for(fe[xe]=null,xe=0;xe<pe.length;xe++){var ye=pe[xe];ye!==null&&(ye.lane&=-536870913)}a&=~Ee}u!==0&&Vt(s,u,0),N!==0&&E===0&&s.tag!==0&&(s.suspendedLanes|=N&~(D&~i))}function Vt(s,i,a){s.pendingLanes|=i,s.suspendedLanes&=~i;var u=31-ts(i);s.entangledLanes|=i,s.entanglements[u]=s.entanglements[u]|1073741824|a&261930}function Ns(s,i){var a=s.entangledLanes|=i;for(s=s.entanglements;a;){var u=31-ts(a),E=1<<u;E&i|s[u]&i&&(s[u]|=i),a&=~E}}function gi(s,i){var a=i&-i;return a=(a&42)!==0?1:Ks(a),(a&(s.suspendedLanes|i))!==0?0:a}function Ks(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 _i(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Mi(){var s=se.p;return s!==0?s:(s=window.event,s===void 0?32:Gy(s.type))}function oe(s,i){var a=se.p;try{return se.p=s,i()}finally{se.p=a}}var ge=Math.random().toString(36).slice(2),ve="__reactFiber$"+ge,Se="__reactProps$"+ge,Me="__reactContainer$"+ge,Je="__reactEvents$"+ge,_t="__reactListeners$"+ge,Rt="__reactHandles$"+ge,Tt="__reactResources$"+ge,yt="__reactMarker$"+ge;function At(s){delete s[ve],delete s[Se],delete s[Je],delete s[_t],delete s[Rt]}function _e(s){var i=s[ve];if(i)return i;for(var a=s.parentNode;a;){if(i=a[Me]||a[ve]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(s=Ny(s);s!==null;){if(a=s[ve])return a;s=Ny(s)}return i}s=a,a=s.parentNode}return null}function De(s){if(s=s[ve]||s[Me]){var i=s.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return s}return null}function Oe(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s.stateNode;throw Error(r(33))}function Ze(s){var i=s[Tt];return i||(i=s[Tt]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function ot(s){s[yt]=!0}var bs=new Set,Ve={};function He(s,i){lt(s,i),lt(s+"Capture",i)}function lt(s,i){for(Ve[s]=i,s=0;s<i.length;s++)bs.add(i[s])}var ss=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]*$"),Jt={},sn={};function So(s){return ut.call(sn,s)?!0:ut.call(Jt,s)?!1:ss.test(s)?sn[s]=!0:(Jt[s]=!0,!1)}function nn(s,i,a){if(So(i))if(a===null)s.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":s.removeAttribute(i);return;case"boolean":var u=i.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){s.removeAttribute(i);return}}s.setAttribute(i,""+a)}}function la(s,i,a){if(a===null)s.removeAttribute(i);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(i);return}s.setAttribute(i,""+a)}}function Oi(s,i,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(i,a,""+u)}}function oi(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Cr(s){var i=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function sc(s,i,a){var u=Object.getOwnPropertyDescriptor(s.constructor.prototype,i);if(!s.hasOwnProperty(i)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var E=u.get,N=u.set;return Object.defineProperty(s,i,{configurable:!0,get:function(){return E.call(this)},set:function(D){a=""+D,N.call(this,D)}}),Object.defineProperty(s,i,{enumerable:u.enumerable}),{getValue:function(){return a},setValue:function(D){a=""+D},stopTracking:function(){s._valueTracker=null,delete s[i]}}}}function wo(s){if(!s._valueTracker){var i=Cr(s)?"checked":"value";s._valueTracker=sc(s,i,""+s[i])}}function ic(s){if(!s)return!1;var i=s._valueTracker;if(!i)return!0;var a=i.getValue(),u="";return s&&(u=Cr(s)?s.checked?"true":"false":s.value),s=u,s!==a?(i.setValue(s),!0):!1}function Er(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 nc=/[\n"\\]/g;function Qs(s){return s.replace(nc,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function ca(s,i,a,u,E,N,D,K){s.name="",D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?s.type=D:s.removeAttribute("type"),i!=null?D==="number"?(i===0&&s.value===""||s.value!=i)&&(s.value=""+oi(i)):s.value!==""+oi(i)&&(s.value=""+oi(i)):D!=="submit"&&D!=="reset"||s.removeAttribute("value"),i!=null?ua(s,D,oi(i)):a!=null?ua(s,D,oi(a)):u!=null&&s.removeAttribute("value"),E==null&&N!=null&&(s.defaultChecked=!!N),E!=null&&(s.checked=E&&typeof E!="function"&&typeof E!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?s.name=""+oi(K):s.removeAttribute("name")}function xo(s,i,a,u,E,N,D,K){if(N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(s.type=N),i!=null||a!=null){if(!(N!=="submit"&&N!=="reset"||i!=null)){wo(s);return}a=a!=null?""+oi(a):"",i=i!=null?""+oi(i):a,K||i===s.value||(s.value=i),s.defaultValue=i}u=u??E,u=typeof u!="function"&&typeof u!="symbol"&&!!u,s.checked=K?s.checked:!!u,s.defaultChecked=!!u,D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(s.name=D),wo(s)}function ua(s,i,a){i==="number"&&Er(s.ownerDocument)===s||s.defaultValue===""+a||(s.defaultValue=""+a)}function pn(s,i,a,u){if(s=s.options,i){i={};for(var E=0;E<a.length;E++)i["$"+a[E]]=!0;for(a=0;a<s.length;a++)E=i.hasOwnProperty("$"+s[a].value),s[a].selected!==E&&(s[a].selected=E),E&&u&&(s[a].defaultSelected=!0)}else{for(a=""+oi(a),i=null,E=0;E<s.length;E++){if(s[E].value===a){s[E].selected=!0,u&&(s[E].defaultSelected=!0);return}i!==null||s[E].disabled||(i=s[E])}i!==null&&(i.selected=!0)}}function Co(s,i,a){if(i!=null&&(i=""+oi(i),i!==s.value&&(s.value=i),a==null)){s.defaultValue!==i&&(s.defaultValue=i);return}s.defaultValue=a!=null?""+oi(a):""}function Eo(s,i,a,u){if(i==null){if(u!=null){if(a!=null)throw Error(r(92));if(te(u)){if(1<u.length)throw Error(r(93));u=u[0]}a=u}a==null&&(a=""),i=a}a=oi(i),s.defaultValue=a,u=s.textContent,u===a&&u!==""&&u!==null&&(s.value=u),wo(s)}function mn(s,i){if(i){var a=s.firstChild;if(a&&a===s.lastChild&&a.nodeType===3){a.nodeValue=i;return}}s.textContent=i}var rc=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 ko(s,i,a){var u=i.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?u?s.setProperty(i,""):i==="float"?s.cssFloat="":s[i]="":u?s.setProperty(i,a):typeof a!="number"||a===0||rc.has(i)?i==="float"?s.cssFloat=a:s[i]=(""+a).trim():s[i]=a+"px"}function jo(s,i,a){if(i!=null&&typeof i!="object")throw Error(r(62));if(s=s.style,a!=null){for(var u in a)!a.hasOwnProperty(u)||i!=null&&i.hasOwnProperty(u)||(u.indexOf("--")===0?s.setProperty(u,""):u==="float"?s.cssFloat="":s[u]="");for(var E in i)u=i[E],i.hasOwnProperty(E)&&a[E]!==u&&ko(s,E,u)}else for(var N in i)i.hasOwnProperty(N)&&ko(s,N,i[N])}function da(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 ac=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"]]),oc=/^[\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 kr(s){return oc.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Di(){}var ha=null;function fa(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var vn=null,Q=null;function be(s){var i=De(s);if(i&&(s=i.stateNode)){var a=s[Se]||null;e:switch(s=i.stateNode,i.type){case"input":if(ca(s,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),i=a.name,a.type==="radio"&&i!=null){for(a=s;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Qs(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var u=a[i];if(u!==s&&u.form===s.form){var E=u[Se]||null;if(!E)throw Error(r(90));ca(u,E.value,E.defaultValue,E.defaultValue,E.checked,E.defaultChecked,E.type,E.name)}}for(i=0;i<a.length;i++)u=a[i],u.form===s.form&&ic(u)}break e;case"textarea":Co(s,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&pn(s,!!a.multiple,i,!1)}}}var Re=!1;function Qe(s,i,a){if(Re)return s(i,a);Re=!0;try{var u=s(i);return u}finally{if(Re=!1,(vn!==null||Q!==null)&&(Kc(),vn&&(i=vn,s=Q,Q=vn=null,be(i),s)))for(i=0;i<s.length;i++)be(s[i])}}function $t(s,i){var a=s.stateNode;if(a===null)return null;var u=a[Se]||null;if(u===null)return null;a=u[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(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,i,typeof a));return a}var is=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ss=!1;if(is)try{var Gn={};Object.defineProperty(Gn,"passive",{get:function(){Ss=!0}}),window.addEventListener("test",Gn,Gn),window.removeEventListener("test",Gn,Gn)}catch{Ss=!1}var Kn=null,Mh=null,lc=null;function Cg(){if(lc)return lc;var s,i=Mh,a=i.length,u,E="value"in Kn?Kn.value:Kn.textContent,N=E.length;for(s=0;s<a&&i[s]===E[s];s++);var D=a-s;for(u=1;u<=D&&i[a-u]===E[N-u];u++);return lc=E.slice(s,1<u?1-u:void 0)}function cc(s){var i=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&i===13&&(s=13)):s=i,s===10&&(s=13),32<=s||s===13?s:0}function uc(){return!0}function Eg(){return!1}function li(s){function i(a,u,E,N,D){this._reactName=a,this._targetInst=E,this.type=u,this.nativeEvent=N,this.target=D,this.currentTarget=null;for(var K in s)s.hasOwnProperty(K)&&(a=s[K],this[K]=a?a(N):N[K]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?uc:Eg,this.isPropagationStopped=Eg,this}return v(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=uc)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=uc)},persist:function(){},isPersistent:uc}),i}var jr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},dc=li(jr),Ao=v({},jr,{view:0,detail:0}),L2=li(Ao),Oh,Dh,Ro,hc=v({},Ao,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Lh,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!==Ro&&(Ro&&s.type==="mousemove"?(Oh=s.screenX-Ro.screenX,Dh=s.screenY-Ro.screenY):Dh=Oh=0,Ro=s),Oh)},movementY:function(s){return"movementY"in s?s.movementY:Dh}}),kg=li(hc),I2=v({},hc,{dataTransfer:0}),P2=li(I2),B2=v({},Ao,{relatedTarget:0}),$h=li(B2),H2=v({},jr,{animationName:0,elapsedTime:0,pseudoElement:0}),z2=li(H2),U2=v({},jr,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),q2=li(U2),F2=v({},jr,{data:0}),jg=li(F2),V2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},W2={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"},G2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function K2(s){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(s):(s=G2[s])?!!i[s]:!1}function Lh(){return K2}var Y2=v({},Ao,{key:function(s){if(s.key){var i=V2[s.key]||s.key;if(i!=="Unidentified")return i}return s.type==="keypress"?(s=cc(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?W2[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Lh,charCode:function(s){return s.type==="keypress"?cc(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?cc(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),X2=li(Y2),J2=v({},hc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ag=li(J2),Z2=v({},Ao,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Lh}),Q2=li(Z2),eE=v({},jr,{propertyName:0,elapsedTime:0,pseudoElement:0}),tE=li(eE),sE=v({},hc,{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}),iE=li(sE),nE=v({},jr,{newState:0,oldState:0}),rE=li(nE),aE=[9,13,27,32],Ih=is&&"CompositionEvent"in window,To=null;is&&"documentMode"in document&&(To=document.documentMode);var oE=is&&"TextEvent"in window&&!To,Rg=is&&(!Ih||To&&8<To&&11>=To),Tg=" ",Ng=!1;function Mg(s,i){switch(s){case"keyup":return aE.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Og(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var pa=!1;function lE(s,i){switch(s){case"compositionend":return Og(i);case"keypress":return i.which!==32?null:(Ng=!0,Tg);case"textInput":return s=i.data,s===Tg&&Ng?null:s;default:return null}}function cE(s,i){if(pa)return s==="compositionend"||!Ih&&Mg(s,i)?(s=Cg(),lc=Mh=Kn=null,pa=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Rg&&i.locale!=="ko"?null:i.data;default:return null}}var uE={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 Dg(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i==="input"?!!uE[s.type]:i==="textarea"}function $g(s,i,a,u){vn?Q?Q.push(u):Q=[u]:vn=u,i=tu(i,"onChange"),0<i.length&&(a=new dc("onChange","change",null,a,u),s.push({event:a,listeners:i}))}var No=null,Mo=null;function dE(s){gy(s,0)}function fc(s){var i=Oe(s);if(ic(i))return s}function Lg(s,i){if(s==="change")return i}var Ig=!1;if(is){var Ph;if(is){var Bh="oninput"in document;if(!Bh){var Pg=document.createElement("div");Pg.setAttribute("oninput","return;"),Bh=typeof Pg.oninput=="function"}Ph=Bh}else Ph=!1;Ig=Ph&&(!document.documentMode||9<document.documentMode)}function Bg(){No&&(No.detachEvent("onpropertychange",Hg),Mo=No=null)}function Hg(s){if(s.propertyName==="value"&&fc(Mo)){var i=[];$g(i,Mo,s,fa(s)),Qe(dE,i)}}function hE(s,i,a){s==="focusin"?(Bg(),No=i,Mo=a,No.attachEvent("onpropertychange",Hg)):s==="focusout"&&Bg()}function fE(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return fc(Mo)}function pE(s,i){if(s==="click")return fc(i)}function mE(s,i){if(s==="input"||s==="change")return fc(i)}function vE(s,i){return s===i&&(s!==0||1/s===1/i)||s!==s&&i!==i}var yi=typeof Object.is=="function"?Object.is:vE;function Oo(s,i){if(yi(s,i))return!0;if(typeof s!="object"||s===null||typeof i!="object"||i===null)return!1;var a=Object.keys(s),u=Object.keys(i);if(a.length!==u.length)return!1;for(u=0;u<a.length;u++){var E=a[u];if(!ut.call(i,E)||!yi(s[E],i[E]))return!1}return!0}function zg(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Ug(s,i){var a=zg(s);s=0;for(var u;a;){if(a.nodeType===3){if(u=s+a.textContent.length,s<=i&&u>=i)return{node:a,offset:i-s};s=u}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=zg(a)}}function qg(s,i){return s&&i?s===i?!0:s&&s.nodeType===3?!1:i&&i.nodeType===3?qg(s,i.parentNode):"contains"in s?s.contains(i):s.compareDocumentPosition?!!(s.compareDocumentPosition(i)&16):!1:!1}function Fg(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var i=Er(s.document);i instanceof s.HTMLIFrameElement;){try{var a=typeof i.contentWindow.location.href=="string"}catch{a=!1}if(a)s=i.contentWindow;else break;i=Er(s.document)}return i}function Hh(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i&&(i==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||i==="textarea"||s.contentEditable==="true")}var gE=is&&"documentMode"in document&&11>=document.documentMode,ma=null,zh=null,Do=null,Uh=!1;function Vg(s,i,a){var u=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Uh||ma==null||ma!==Er(u)||(u=ma,"selectionStart"in u&&Hh(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}),Do&&Oo(Do,u)||(Do=u,u=tu(zh,"onSelect"),0<u.length&&(i=new dc("onSelect","select",null,i,a),s.push({event:i,listeners:u}),i.target=ma)))}function Ar(s,i){var a={};return a[s.toLowerCase()]=i.toLowerCase(),a["Webkit"+s]="webkit"+i,a["Moz"+s]="moz"+i,a}var va={animationend:Ar("Animation","AnimationEnd"),animationiteration:Ar("Animation","AnimationIteration"),animationstart:Ar("Animation","AnimationStart"),transitionrun:Ar("Transition","TransitionRun"),transitionstart:Ar("Transition","TransitionStart"),transitioncancel:Ar("Transition","TransitionCancel"),transitionend:Ar("Transition","TransitionEnd")},qh={},Wg={};is&&(Wg=document.createElement("div").style,"AnimationEvent"in window||(delete va.animationend.animation,delete va.animationiteration.animation,delete va.animationstart.animation),"TransitionEvent"in window||delete va.transitionend.transition);function Rr(s){if(qh[s])return qh[s];if(!va[s])return s;var i=va[s],a;for(a in i)if(i.hasOwnProperty(a)&&a in Wg)return qh[s]=i[a];return s}var Gg=Rr("animationend"),Kg=Rr("animationiteration"),Yg=Rr("animationstart"),_E=Rr("transitionrun"),yE=Rr("transitionstart"),bE=Rr("transitioncancel"),Xg=Rr("transitionend"),Jg=new Map,Fh="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(" ");Fh.push("scrollEnd");function Gi(s,i){Jg.set(s,i),He(i,[s])}var pc=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},$i=[],ga=0,Vh=0;function mc(){for(var s=ga,i=Vh=ga=0;i<s;){var a=$i[i];$i[i++]=null;var u=$i[i];$i[i++]=null;var E=$i[i];$i[i++]=null;var N=$i[i];if($i[i++]=null,u!==null&&E!==null){var D=u.pending;D===null?E.next=E:(E.next=D.next,D.next=E),u.pending=E}N!==0&&Zg(a,E,N)}}function vc(s,i,a,u){$i[ga++]=s,$i[ga++]=i,$i[ga++]=a,$i[ga++]=u,Vh|=u,s.lanes|=u,s=s.alternate,s!==null&&(s.lanes|=u)}function Wh(s,i,a,u){return vc(s,i,a,u),gc(s)}function Tr(s,i){return vc(s,null,null,i),gc(s)}function Zg(s,i,a){s.lanes|=a;var u=s.alternate;u!==null&&(u.lanes|=a);for(var E=!1,N=s.return;N!==null;)N.childLanes|=a,u=N.alternate,u!==null&&(u.childLanes|=a),N.tag===22&&(s=N.stateNode,s===null||s._visibility&1||(E=!0)),s=N,N=N.return;return s.tag===3?(N=s.stateNode,E&&i!==null&&(E=31-ts(a),s=N.hiddenUpdates,u=s[E],u===null?s[E]=[i]:u.push(i),i.lane=a|536870912),N):null}function gc(s){if(50<sl)throw sl=0,sp=null,Error(r(185));for(var i=s.return;i!==null;)s=i,i=s.return;return s.tag===3?s.stateNode:null}var _a={};function SE(s,i,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=i,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 bi(s,i,a,u){return new SE(s,i,a,u)}function Gh(s){return s=s.prototype,!(!s||!s.isReactComponent)}function gn(s,i){var a=s.alternate;return a===null?(a=bi(s.tag,i,s.key,s.mode),a.elementType=s.elementType,a.type=s.type,a.stateNode=s.stateNode,a.alternate=s,s.alternate=a):(a.pendingProps=i,a.type=s.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=s.flags&65011712,a.childLanes=s.childLanes,a.lanes=s.lanes,a.child=s.child,a.memoizedProps=s.memoizedProps,a.memoizedState=s.memoizedState,a.updateQueue=s.updateQueue,i=s.dependencies,a.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},a.sibling=s.sibling,a.index=s.index,a.ref=s.ref,a.refCleanup=s.refCleanup,a}function Qg(s,i){s.flags&=65011714;var a=s.alternate;return a===null?(s.childLanes=0,s.lanes=i,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=a.childLanes,s.lanes=a.lanes,s.child=a.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=a.memoizedProps,s.memoizedState=a.memoizedState,s.updateQueue=a.updateQueue,s.type=a.type,i=a.dependencies,s.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),s}function _c(s,i,a,u,E,N){var D=0;if(u=s,typeof s=="function")Gh(s)&&(D=1);else if(typeof s=="string")D=kk(s,a,I.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case M:return s=bi(31,a,i,E),s.elementType=M,s.lanes=N,s;case x:return Nr(a.children,E,N,i);case g:D=8,E|=24;break;case b:return s=bi(12,a,i,E|2),s.elementType=b,s.lanes=N,s;case j:return s=bi(13,a,i,E),s.elementType=j,s.lanes=N,s;case C:return s=bi(19,a,i,E),s.elementType=C,s.lanes=N,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case _:D=10;break e;case p:D=9;break e;case k:D=11;break e;case T:D=14;break e;case A:D=16,u=null;break e}D=29,a=Error(r(130,s===null?"null":typeof s,"")),u=null}return i=bi(D,a,i,E),i.elementType=s,i.type=u,i.lanes=N,i}function Nr(s,i,a,u){return s=bi(7,s,u,i),s.lanes=a,s}function Kh(s,i,a){return s=bi(6,s,null,i),s.lanes=a,s}function e_(s){var i=bi(18,null,null,0);return i.stateNode=s,i}function Yh(s,i,a){return i=bi(4,s.children!==null?s.children:[],s.key,i),i.lanes=a,i.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},i}var t_=new WeakMap;function Li(s,i){if(typeof s=="object"&&s!==null){var a=t_.get(s);return a!==void 0?a:(i={value:s,source:i,stack:ct(i)},t_.set(s,i),i)}return{value:s,source:i,stack:ct(i)}}var ya=[],ba=0,yc=null,$o=0,Ii=[],Pi=0,Yn=null,rn=1,an="";function _n(s,i){ya[ba++]=$o,ya[ba++]=yc,yc=s,$o=i}function s_(s,i,a){Ii[Pi++]=rn,Ii[Pi++]=an,Ii[Pi++]=Yn,Yn=s;var u=rn;s=an;var E=32-ts(u)-1;u&=~(1<<E),a+=1;var N=32-ts(i)+E;if(30<N){var D=E-E%5;N=(u&(1<<D)-1).toString(32),u>>=D,E-=D,rn=1<<32-ts(i)+E|a<<E|u,an=N+s}else rn=1<<N|a<<E|u,an=s}function Xh(s){s.return!==null&&(_n(s,1),s_(s,1,0))}function Jh(s){for(;s===yc;)yc=ya[--ba],ya[ba]=null,$o=ya[--ba],ya[ba]=null;for(;s===Yn;)Yn=Ii[--Pi],Ii[Pi]=null,an=Ii[--Pi],Ii[Pi]=null,rn=Ii[--Pi],Ii[Pi]=null}function i_(s,i){Ii[Pi++]=rn,Ii[Pi++]=an,Ii[Pi++]=Yn,rn=i.id,an=i.overflow,Yn=s}var Ps=null,ns=null,kt=!1,Xn=null,Bi=!1,Zh=Error(r(519));function Jn(s){var i=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Lo(Li(i,s)),Zh}function n_(s){var i=s.stateNode,a=s.type,u=s.memoizedProps;switch(i[ve]=s,i[Se]=u,a){case"dialog":St("cancel",i),St("close",i);break;case"iframe":case"object":case"embed":St("load",i);break;case"video":case"audio":for(a=0;a<nl.length;a++)St(nl[a],i);break;case"source":St("error",i);break;case"img":case"image":case"link":St("error",i),St("load",i);break;case"details":St("toggle",i);break;case"input":St("invalid",i),xo(i,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":St("invalid",i);break;case"textarea":St("invalid",i),Eo(i,u.value,u.defaultValue,u.children)}a=u.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||i.textContent===""+a||u.suppressHydrationWarning===!0||Sy(i.textContent,a)?(u.popover!=null&&(St("beforetoggle",i),St("toggle",i)),u.onScroll!=null&&St("scroll",i),u.onScrollEnd!=null&&St("scrollend",i),u.onClick!=null&&(i.onclick=Di),i=!0):i=!1,i||Jn(s,!0)}function r_(s){for(Ps=s.return;Ps;)switch(Ps.tag){case 5:case 31:case 13:Bi=!1;return;case 27:case 3:Bi=!0;return;default:Ps=Ps.return}}function Sa(s){if(s!==Ps)return!1;if(!kt)return r_(s),kt=!0,!1;var i=s.tag,a;if((a=i!==3&&i!==27)&&((a=i===5)&&(a=s.type,a=!(a!=="form"&&a!=="button")||gp(s.type,s.memoizedProps)),a=!a),a&&ns&&Jn(s),r_(s),i===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));ns=Ty(s)}else if(i===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));ns=Ty(s)}else i===27?(i=ns,dr(s.type)?(s=wp,wp=null,ns=s):ns=i):ns=Ps?zi(s.stateNode.nextSibling):null;return!0}function Mr(){ns=Ps=null,kt=!1}function Qh(){var s=Xn;return s!==null&&(hi===null?hi=s:hi.push.apply(hi,s),Xn=null),s}function Lo(s){Xn===null?Xn=[s]:Xn.push(s)}var ef=O(null),Or=null,yn=null;function Zn(s,i,a){z(ef,i._currentValue),i._currentValue=a}function bn(s){s._currentValue=ef.current,P(ef)}function tf(s,i,a){for(;s!==null;){var u=s.alternate;if((s.childLanes&i)!==i?(s.childLanes|=i,u!==null&&(u.childLanes|=i)):u!==null&&(u.childLanes&i)!==i&&(u.childLanes|=i),s===a)break;s=s.return}}function sf(s,i,a,u){var E=s.child;for(E!==null&&(E.return=s);E!==null;){var N=E.dependencies;if(N!==null){var D=E.child;N=N.firstContext;e:for(;N!==null;){var K=N;N=E;for(var ne=0;ne<i.length;ne++)if(K.context===i[ne]){N.lanes|=a,K=N.alternate,K!==null&&(K.lanes|=a),tf(N.return,a,s),u||(D=null);break e}N=K.next}}else if(E.tag===18){if(D=E.return,D===null)throw Error(r(341));D.lanes|=a,N=D.alternate,N!==null&&(N.lanes|=a),tf(D,a,s),D=null}else D=E.child;if(D!==null)D.return=E;else for(D=E;D!==null;){if(D===s){D=null;break}if(E=D.sibling,E!==null){E.return=D.return,D=E;break}D=D.return}E=D}}function wa(s,i,a,u){s=null;for(var E=i,N=!1;E!==null;){if(!N){if((E.flags&524288)!==0)N=!0;else if((E.flags&262144)!==0)break}if(E.tag===10){var D=E.alternate;if(D===null)throw Error(r(387));if(D=D.memoizedProps,D!==null){var K=E.type;yi(E.pendingProps.value,D.value)||(s!==null?s.push(K):s=[K])}}else if(E===X.current){if(D=E.alternate,D===null)throw Error(r(387));D.memoizedState.memoizedState!==E.memoizedState.memoizedState&&(s!==null?s.push(cl):s=[cl])}E=E.return}s!==null&&sf(i,s,a,u),i.flags|=262144}function bc(s){for(s=s.firstContext;s!==null;){if(!yi(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Dr(s){Or=s,yn=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Bs(s){return a_(Or,s)}function Sc(s,i){return Or===null&&Dr(s),a_(s,i)}function a_(s,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},yn===null){if(s===null)throw Error(r(308));yn=i,s.dependencies={lanes:0,firstContext:i},s.flags|=524288}else yn=yn.next=i;return a}var wE=typeof AbortController<"u"?AbortController:function(){var s=[],i=this.signal={aborted:!1,addEventListener:function(a,u){s.push(u)}};this.abort=function(){i.aborted=!0,s.forEach(function(a){return a()})}},xE=e.unstable_scheduleCallback,CE=e.unstable_NormalPriority,Es={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function nf(){return{controller:new wE,data:new Map,refCount:0}}function Io(s){s.refCount--,s.refCount===0&&xE(CE,function(){s.controller.abort()})}var Po=null,rf=0,xa=0,Ca=null;function EE(s,i){if(Po===null){var a=Po=[];rf=0,xa=lp(),Ca={status:"pending",value:void 0,then:function(u){a.push(u)}}}return rf++,i.then(o_,o_),i}function o_(){if(--rf===0&&Po!==null){Ca!==null&&(Ca.status="fulfilled");var s=Po;Po=null,xa=0,Ca=null;for(var i=0;i<s.length;i++)(0,s[i])()}}function kE(s,i){var a=[],u={status:"pending",value:null,reason:null,then:function(E){a.push(E)}};return s.then(function(){u.status="fulfilled",u.value=i;for(var E=0;E<a.length;E++)(0,a[E])(i)},function(E){for(u.status="rejected",u.reason=E,E=0;E<a.length;E++)(0,a[E])(void 0)}),u}var l_=W.S;W.S=function(s,i){V0=Ke(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&EE(s,i),l_!==null&&l_(s,i)};var $r=O(null);function af(){var s=$r.current;return s!==null?s:Zt.pooledCache}function wc(s,i){i===null?z($r,$r.current):z($r,i.pool)}function c_(){var s=af();return s===null?null:{parent:Es._currentValue,pool:s}}var Ea=Error(r(460)),of=Error(r(474)),xc=Error(r(542)),Cc={then:function(){}};function u_(s){return s=s.status,s==="fulfilled"||s==="rejected"}function d_(s,i,a){switch(a=s[a],a===void 0?s.push(i):a!==i&&(i.then(Di,Di),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw s=i.reason,f_(s),s;default:if(typeof i.status=="string")i.then(Di,Di);else{if(s=Zt,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=i,s.status="pending",s.then(function(u){if(i.status==="pending"){var E=i;E.status="fulfilled",E.value=u}},function(u){if(i.status==="pending"){var E=i;E.status="rejected",E.reason=u}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw s=i.reason,f_(s),s}throw Ir=i,Ea}}function Lr(s){try{var i=s._init;return i(s._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Ir=a,Ea):a}}var Ir=null;function h_(){if(Ir===null)throw Error(r(459));var s=Ir;return Ir=null,s}function f_(s){if(s===Ea||s===xc)throw Error(r(483))}var ka=null,Bo=0;function Ec(s){var i=Bo;return Bo+=1,ka===null&&(ka=[]),d_(ka,s,i)}function Ho(s,i){i=i.props.ref,s.ref=i!==void 0?i:null}function kc(s,i){throw i.$$typeof===S?Error(r(525)):(s=Object.prototype.toString.call(i),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":s)))}function p_(s){function i(le,re){if(s){var he=le.deletions;he===null?(le.deletions=[re],le.flags|=16):he.push(re)}}function a(le,re){if(!s)return null;for(;re!==null;)i(le,re),re=re.sibling;return null}function u(le){for(var re=new Map;le!==null;)le.key!==null?re.set(le.key,le):re.set(le.index,le),le=le.sibling;return re}function E(le,re){return le=gn(le,re),le.index=0,le.sibling=null,le}function N(le,re,he){return le.index=he,s?(he=le.alternate,he!==null?(he=he.index,he<re?(le.flags|=67108866,re):he):(le.flags|=67108866,re)):(le.flags|=1048576,re)}function D(le){return s&&le.alternate===null&&(le.flags|=67108866),le}function K(le,re,he,Ce){return re===null||re.tag!==6?(re=Kh(he,le.mode,Ce),re.return=le,re):(re=E(re,he),re.return=le,re)}function ne(le,re,he,Ce){var qe=he.type;return qe===x?xe(le,re,he.props.children,Ce,he.key):re!==null&&(re.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===A&&Lr(qe)===re.type)?(re=E(re,he.props),Ho(re,he),re.return=le,re):(re=_c(he.type,he.key,he.props,null,le.mode,Ce),Ho(re,he),re.return=le,re)}function fe(le,re,he,Ce){return re===null||re.tag!==4||re.stateNode.containerInfo!==he.containerInfo||re.stateNode.implementation!==he.implementation?(re=Yh(he,le.mode,Ce),re.return=le,re):(re=E(re,he.children||[]),re.return=le,re)}function xe(le,re,he,Ce,qe){return re===null||re.tag!==7?(re=Nr(he,le.mode,Ce,qe),re.return=le,re):(re=E(re,he),re.return=le,re)}function Ee(le,re,he){if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return re=Kh(""+re,le.mode,he),re.return=le,re;if(typeof re=="object"&&re!==null){switch(re.$$typeof){case w:return he=_c(re.type,re.key,re.props,null,le.mode,he),Ho(he,re),he.return=le,he;case R:return re=Yh(re,le.mode,he),re.return=le,re;case A:return re=Lr(re),Ee(le,re,he)}if(te(re)||q(re))return re=Nr(re,le.mode,he,null),re.return=le,re;if(typeof re.then=="function")return Ee(le,Ec(re),he);if(re.$$typeof===_)return Ee(le,Sc(le,re),he);kc(le,re)}return null}function pe(le,re,he,Ce){var qe=re!==null?re.key:null;if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return qe!==null?null:K(le,re,""+he,Ce);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case w:return he.key===qe?ne(le,re,he,Ce):null;case R:return he.key===qe?fe(le,re,he,Ce):null;case A:return he=Lr(he),pe(le,re,he,Ce)}if(te(he)||q(he))return qe!==null?null:xe(le,re,he,Ce,null);if(typeof he.then=="function")return pe(le,re,Ec(he),Ce);if(he.$$typeof===_)return pe(le,re,Sc(le,he),Ce);kc(le,he)}return null}function ye(le,re,he,Ce,qe){if(typeof Ce=="string"&&Ce!==""||typeof Ce=="number"||typeof Ce=="bigint")return le=le.get(he)||null,K(re,le,""+Ce,qe);if(typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case w:return le=le.get(Ce.key===null?he:Ce.key)||null,ne(re,le,Ce,qe);case R:return le=le.get(Ce.key===null?he:Ce.key)||null,fe(re,le,Ce,qe);case A:return Ce=Lr(Ce),ye(le,re,he,Ce,qe)}if(te(Ce)||q(Ce))return le=le.get(he)||null,xe(re,le,Ce,qe,null);if(typeof Ce.then=="function")return ye(le,re,he,Ec(Ce),qe);if(Ce.$$typeof===_)return ye(le,re,he,Sc(re,Ce),qe);kc(re,Ce)}return null}function Be(le,re,he,Ce){for(var qe=null,Nt=null,ze=re,ht=re=0,Et=null;ze!==null&&ht<he.length;ht++){ze.index>ht?(Et=ze,ze=null):Et=ze.sibling;var Mt=pe(le,ze,he[ht],Ce);if(Mt===null){ze===null&&(ze=Et);break}s&&ze&&Mt.alternate===null&&i(le,ze),re=N(Mt,re,ht),Nt===null?qe=Mt:Nt.sibling=Mt,Nt=Mt,ze=Et}if(ht===he.length)return a(le,ze),kt&&_n(le,ht),qe;if(ze===null){for(;ht<he.length;ht++)ze=Ee(le,he[ht],Ce),ze!==null&&(re=N(ze,re,ht),Nt===null?qe=ze:Nt.sibling=ze,Nt=ze);return kt&&_n(le,ht),qe}for(ze=u(ze);ht<he.length;ht++)Et=ye(ze,le,ht,he[ht],Ce),Et!==null&&(s&&Et.alternate!==null&&ze.delete(Et.key===null?ht:Et.key),re=N(Et,re,ht),Nt===null?qe=Et:Nt.sibling=Et,Nt=Et);return s&&ze.forEach(function(vr){return i(le,vr)}),kt&&_n(le,ht),qe}function We(le,re,he,Ce){if(he==null)throw Error(r(151));for(var qe=null,Nt=null,ze=re,ht=re=0,Et=null,Mt=he.next();ze!==null&&!Mt.done;ht++,Mt=he.next()){ze.index>ht?(Et=ze,ze=null):Et=ze.sibling;var vr=pe(le,ze,Mt.value,Ce);if(vr===null){ze===null&&(ze=Et);break}s&&ze&&vr.alternate===null&&i(le,ze),re=N(vr,re,ht),Nt===null?qe=vr:Nt.sibling=vr,Nt=vr,ze=Et}if(Mt.done)return a(le,ze),kt&&_n(le,ht),qe;if(ze===null){for(;!Mt.done;ht++,Mt=he.next())Mt=Ee(le,Mt.value,Ce),Mt!==null&&(re=N(Mt,re,ht),Nt===null?qe=Mt:Nt.sibling=Mt,Nt=Mt);return kt&&_n(le,ht),qe}for(ze=u(ze);!Mt.done;ht++,Mt=he.next())Mt=ye(ze,le,ht,Mt.value,Ce),Mt!==null&&(s&&Mt.alternate!==null&&ze.delete(Mt.key===null?ht:Mt.key),re=N(Mt,re,ht),Nt===null?qe=Mt:Nt.sibling=Mt,Nt=Mt);return s&&ze.forEach(function(Ik){return i(le,Ik)}),kt&&_n(le,ht),qe}function Kt(le,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 qe=he.key;re!==null;){if(re.key===qe){if(qe=he.type,qe===x){if(re.tag===7){a(le,re.sibling),Ce=E(re,he.props.children),Ce.return=le,le=Ce;break e}}else if(re.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===A&&Lr(qe)===re.type){a(le,re.sibling),Ce=E(re,he.props),Ho(Ce,he),Ce.return=le,le=Ce;break e}a(le,re);break}else i(le,re);re=re.sibling}he.type===x?(Ce=Nr(he.props.children,le.mode,Ce,he.key),Ce.return=le,le=Ce):(Ce=_c(he.type,he.key,he.props,null,le.mode,Ce),Ho(Ce,he),Ce.return=le,le=Ce)}return D(le);case R:e:{for(qe=he.key;re!==null;){if(re.key===qe)if(re.tag===4&&re.stateNode.containerInfo===he.containerInfo&&re.stateNode.implementation===he.implementation){a(le,re.sibling),Ce=E(re,he.children||[]),Ce.return=le,le=Ce;break e}else{a(le,re);break}else i(le,re);re=re.sibling}Ce=Yh(he,le.mode,Ce),Ce.return=le,le=Ce}return D(le);case A:return he=Lr(he),Kt(le,re,he,Ce)}if(te(he))return Be(le,re,he,Ce);if(q(he)){if(qe=q(he),typeof qe!="function")throw Error(r(150));return he=qe.call(he),We(le,re,he,Ce)}if(typeof he.then=="function")return Kt(le,re,Ec(he),Ce);if(he.$$typeof===_)return Kt(le,re,Sc(le,he),Ce);kc(le,he)}return typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint"?(he=""+he,re!==null&&re.tag===6?(a(le,re.sibling),Ce=E(re,he),Ce.return=le,le=Ce):(a(le,re),Ce=Kh(he,le.mode,Ce),Ce.return=le,le=Ce),D(le)):a(le,re)}return function(le,re,he,Ce){try{Bo=0;var qe=Kt(le,re,he,Ce);return ka=null,qe}catch(ze){if(ze===Ea||ze===xc)throw ze;var Nt=bi(29,ze,null,le.mode);return Nt.lanes=Ce,Nt.return=le,Nt}finally{}}}var Pr=p_(!0),m_=p_(!1),Qn=!1;function lf(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function cf(s,i){s=s.updateQueue,i.updateQueue===s&&(i.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function er(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function tr(s,i,a){var u=s.updateQueue;if(u===null)return null;if(u=u.shared,(Lt&2)!==0){var E=u.pending;return E===null?i.next=i:(i.next=E.next,E.next=i),u.pending=i,i=gc(s),Zg(s,null,a),i}return vc(s,u,i,a),gc(s)}function zo(s,i,a){if(i=i.updateQueue,i!==null&&(i=i.shared,(a&4194048)!==0)){var u=i.lanes;u&=s.pendingLanes,a|=u,i.lanes=a,Ns(s,a)}}function uf(s,i){var a=s.updateQueue,u=s.alternate;if(u!==null&&(u=u.updateQueue,a===u)){var E=null,N=null;if(a=a.firstBaseUpdate,a!==null){do{var D={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};N===null?E=N=D:N=N.next=D,a=a.next}while(a!==null);N===null?E=N=i:N=N.next=i}else E=N=i;a={baseState:u.baseState,firstBaseUpdate:E,lastBaseUpdate:N,shared:u.shared,callbacks:u.callbacks},s.updateQueue=a;return}s=a.lastBaseUpdate,s===null?a.firstBaseUpdate=i:s.next=i,a.lastBaseUpdate=i}var df=!1;function Uo(){if(df){var s=Ca;if(s!==null)throw s}}function qo(s,i,a,u){df=!1;var E=s.updateQueue;Qn=!1;var N=E.firstBaseUpdate,D=E.lastBaseUpdate,K=E.shared.pending;if(K!==null){E.shared.pending=null;var ne=K,fe=ne.next;ne.next=null,D===null?N=fe:D.next=fe,D=ne;var xe=s.alternate;xe!==null&&(xe=xe.updateQueue,K=xe.lastBaseUpdate,K!==D&&(K===null?xe.firstBaseUpdate=fe:K.next=fe,xe.lastBaseUpdate=ne))}if(N!==null){var Ee=E.baseState;D=0,xe=fe=ne=null,K=N;do{var pe=K.lane&-536870913,ye=pe!==K.lane;if(ye?(Ct&pe)===pe:(u&pe)===pe){pe!==0&&pe===xa&&(df=!0),xe!==null&&(xe=xe.next={lane:0,tag:K.tag,payload:K.payload,callback:null,next:null});e:{var Be=s,We=K;pe=i;var Kt=a;switch(We.tag){case 1:if(Be=We.payload,typeof Be=="function"){Ee=Be.call(Kt,Ee,pe);break e}Ee=Be;break e;case 3:Be.flags=Be.flags&-65537|128;case 0:if(Be=We.payload,pe=typeof Be=="function"?Be.call(Kt,Ee,pe):Be,pe==null)break e;Ee=v({},Ee,pe);break e;case 2:Qn=!0}}pe=K.callback,pe!==null&&(s.flags|=64,ye&&(s.flags|=8192),ye=E.callbacks,ye===null?E.callbacks=[pe]:ye.push(pe))}else ye={lane:pe,tag:K.tag,payload:K.payload,callback:K.callback,next:null},xe===null?(fe=xe=ye,ne=Ee):xe=xe.next=ye,D|=pe;if(K=K.next,K===null){if(K=E.shared.pending,K===null)break;ye=K,K=ye.next,ye.next=null,E.lastBaseUpdate=ye,E.shared.pending=null}}while(!0);xe===null&&(ne=Ee),E.baseState=ne,E.firstBaseUpdate=fe,E.lastBaseUpdate=xe,N===null&&(E.shared.lanes=0),ar|=D,s.lanes=D,s.memoizedState=Ee}}function v_(s,i){if(typeof s!="function")throw Error(r(191,s));s.call(i)}function g_(s,i){var a=s.callbacks;if(a!==null)for(s.callbacks=null,s=0;s<a.length;s++)v_(a[s],i)}var ja=O(null),jc=O(0);function __(s,i){s=Rn,z(jc,s),z(ja,i),Rn=s|i.baseLanes}function hf(){z(jc,Rn),z(ja,ja.current)}function ff(){Rn=jc.current,P(ja),P(jc)}var Si=O(null),Hi=null;function sr(s){var i=s.alternate;z(ws,ws.current&1),z(Si,s),Hi===null&&(i===null||ja.current!==null||i.memoizedState!==null)&&(Hi=s)}function pf(s){z(ws,ws.current),z(Si,s),Hi===null&&(Hi=s)}function y_(s){s.tag===22?(z(ws,ws.current),z(Si,s),Hi===null&&(Hi=s)):ir()}function ir(){z(ws,ws.current),z(Si,Si.current)}function wi(s){P(Si),Hi===s&&(Hi=null),P(ws)}var ws=O(0);function Ac(s){for(var i=s;i!==null;){if(i.tag===13){var a=i.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||bp(a)||Sp(a)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Sn=0,dt=null,Wt=null,ks=null,Rc=!1,Aa=!1,Br=!1,Tc=0,Fo=0,Ra=null,jE=0;function ms(){throw Error(r(321))}function mf(s,i){if(i===null)return!1;for(var a=0;a<i.length&&a<s.length;a++)if(!yi(s[a],i[a]))return!1;return!0}function vf(s,i,a,u,E,N){return Sn=N,dt=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,W.H=s===null||s.memoizedState===null?s0:Nf,Br=!1,N=a(u,E),Br=!1,Aa&&(N=S_(i,a,u,E)),b_(s),N}function b_(s){W.H=Go;var i=Wt!==null&&Wt.next!==null;if(Sn=0,ks=Wt=dt=null,Rc=!1,Fo=0,Ra=null,i)throw Error(r(300));s===null||js||(s=s.dependencies,s!==null&&bc(s)&&(js=!0))}function S_(s,i,a,u){dt=s;var E=0;do{if(Aa&&(Ra=null),Fo=0,Aa=!1,25<=E)throw Error(r(301));if(E+=1,ks=Wt=null,s.updateQueue!=null){var N=s.updateQueue;N.lastEffect=null,N.events=null,N.stores=null,N.memoCache!=null&&(N.memoCache.index=0)}W.H=i0,N=i(a,u)}while(Aa);return N}function AE(){var s=W.H,i=s.useState()[0];return i=typeof i.then=="function"?Vo(i):i,s=s.useState()[0],(Wt!==null?Wt.memoizedState:null)!==s&&(dt.flags|=1024),i}function gf(){var s=Tc!==0;return Tc=0,s}function _f(s,i,a){i.updateQueue=s.updateQueue,i.flags&=-2053,s.lanes&=~a}function yf(s){if(Rc){for(s=s.memoizedState;s!==null;){var i=s.queue;i!==null&&(i.pending=null),s=s.next}Rc=!1}Sn=0,ks=Wt=dt=null,Aa=!1,Fo=Tc=0,Ra=null}function ei(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ks===null?dt.memoizedState=ks=s:ks=ks.next=s,ks}function xs(){if(Wt===null){var s=dt.alternate;s=s!==null?s.memoizedState:null}else s=Wt.next;var i=ks===null?dt.memoizedState:ks.next;if(i!==null)ks=i,Wt=s;else{if(s===null)throw dt.alternate===null?Error(r(467)):Error(r(310));Wt=s,s={memoizedState:Wt.memoizedState,baseState:Wt.baseState,baseQueue:Wt.baseQueue,queue:Wt.queue,next:null},ks===null?dt.memoizedState=ks=s:ks=ks.next=s}return ks}function Nc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Vo(s){var i=Fo;return Fo+=1,Ra===null&&(Ra=[]),s=d_(Ra,s,i),i=dt,(ks===null?i.memoizedState:ks.next)===null&&(i=i.alternate,W.H=i===null||i.memoizedState===null?s0:Nf),s}function Mc(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Vo(s);if(s.$$typeof===_)return Bs(s)}throw Error(r(438,String(s)))}function bf(s){var i=null,a=dt.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var u=dt.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(i={data:u.data.map(function(E){return E.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),a===null&&(a=Nc(),dt.updateQueue=a),a.memoCache=i,a=i.data[i.index],a===void 0)for(a=i.data[i.index]=Array(s),u=0;u<s;u++)a[u]=L;return i.index++,a}function wn(s,i){return typeof i=="function"?i(s):i}function Oc(s){var i=xs();return Sf(i,Wt,s)}function Sf(s,i,a){var u=s.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=a;var E=s.baseQueue,N=u.pending;if(N!==null){if(E!==null){var D=E.next;E.next=N.next,N.next=D}i.baseQueue=E=N,u.pending=null}if(N=s.baseState,E===null)s.memoizedState=N;else{i=E.next;var K=D=null,ne=null,fe=i,xe=!1;do{var Ee=fe.lane&-536870913;if(Ee!==fe.lane?(Ct&Ee)===Ee:(Sn&Ee)===Ee){var pe=fe.revertLane;if(pe===0)ne!==null&&(ne=ne.next={lane:0,revertLane:0,gesture:null,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null}),Ee===xa&&(xe=!0);else if((Sn&pe)===pe){fe=fe.next,pe===xa&&(xe=!0);continue}else Ee={lane:0,revertLane:fe.revertLane,gesture:null,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null},ne===null?(K=ne=Ee,D=N):ne=ne.next=Ee,dt.lanes|=pe,ar|=pe;Ee=fe.action,Br&&a(N,Ee),N=fe.hasEagerState?fe.eagerState:a(N,Ee)}else pe={lane:Ee,revertLane:fe.revertLane,gesture:fe.gesture,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null},ne===null?(K=ne=pe,D=N):ne=ne.next=pe,dt.lanes|=Ee,ar|=Ee;fe=fe.next}while(fe!==null&&fe!==i);if(ne===null?D=N:ne.next=K,!yi(N,s.memoizedState)&&(js=!0,xe&&(a=Ca,a!==null)))throw a;s.memoizedState=N,s.baseState=D,s.baseQueue=ne,u.lastRenderedState=N}return E===null&&(u.lanes=0),[s.memoizedState,u.dispatch]}function wf(s){var i=xs(),a=i.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=s;var u=a.dispatch,E=a.pending,N=i.memoizedState;if(E!==null){a.pending=null;var D=E=E.next;do N=s(N,D.action),D=D.next;while(D!==E);yi(N,i.memoizedState)||(js=!0),i.memoizedState=N,i.baseQueue===null&&(i.baseState=N),a.lastRenderedState=N}return[N,u]}function w_(s,i,a){var u=dt,E=xs(),N=kt;if(N){if(a===void 0)throw Error(r(407));a=a()}else a=i();var D=!yi((Wt||E).memoizedState,a);if(D&&(E.memoizedState=a,js=!0),E=E.queue,Ef(E_.bind(null,u,E,s),[s]),E.getSnapshot!==i||D||ks!==null&&ks.memoizedState.tag&1){if(u.flags|=2048,Ta(9,{destroy:void 0},C_.bind(null,u,E,a,i),null),Zt===null)throw Error(r(349));N||(Sn&127)!==0||x_(u,i,a)}return a}function x_(s,i,a){s.flags|=16384,s={getSnapshot:i,value:a},i=dt.updateQueue,i===null?(i=Nc(),dt.updateQueue=i,i.stores=[s]):(a=i.stores,a===null?i.stores=[s]:a.push(s))}function C_(s,i,a,u){i.value=a,i.getSnapshot=u,k_(i)&&j_(s)}function E_(s,i,a){return a(function(){k_(i)&&j_(s)})}function k_(s){var i=s.getSnapshot;s=s.value;try{var a=i();return!yi(s,a)}catch{return!0}}function j_(s){var i=Tr(s,2);i!==null&&fi(i,s,2)}function xf(s){var i=ei();if(typeof s=="function"){var a=s;if(s=a(),Br){Ts(!0);try{a()}finally{Ts(!1)}}}return i.memoizedState=i.baseState=s,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wn,lastRenderedState:s},i}function A_(s,i,a,u){return s.baseState=a,Sf(s,Wt,typeof u=="function"?u:wn)}function RE(s,i,a,u,E){if(Lc(s))throw Error(r(485));if(s=i.action,s!==null){var N={payload:E,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(D){N.listeners.push(D)}};W.T!==null?a(!0):N.isTransition=!1,u(N),a=i.pending,a===null?(N.next=i.pending=N,R_(i,N)):(N.next=a.next,i.pending=a.next=N)}}function R_(s,i){var a=i.action,u=i.payload,E=s.state;if(i.isTransition){var N=W.T,D={};W.T=D;try{var K=a(E,u),ne=W.S;ne!==null&&ne(D,K),T_(s,i,K)}catch(fe){Cf(s,i,fe)}finally{N!==null&&D.types!==null&&(N.types=D.types),W.T=N}}else try{N=a(E,u),T_(s,i,N)}catch(fe){Cf(s,i,fe)}}function T_(s,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(u){N_(s,i,u)},function(u){return Cf(s,i,u)}):N_(s,i,a)}function N_(s,i,a){i.status="fulfilled",i.value=a,M_(i),s.state=a,i=s.pending,i!==null&&(a=i.next,a===i?s.pending=null:(a=a.next,i.next=a,R_(s,a)))}function Cf(s,i,a){var u=s.pending;if(s.pending=null,u!==null){u=u.next;do i.status="rejected",i.reason=a,M_(i),i=i.next;while(i!==u)}s.action=null}function M_(s){s=s.listeners;for(var i=0;i<s.length;i++)(0,s[i])()}function O_(s,i){return i}function D_(s,i){if(kt){var a=Zt.formState;if(a!==null){e:{var u=dt;if(kt){if(ns){t:{for(var E=ns,N=Bi;E.nodeType!==8;){if(!N){E=null;break t}if(E=zi(E.nextSibling),E===null){E=null;break t}}N=E.data,E=N==="F!"||N==="F"?E:null}if(E){ns=zi(E.nextSibling),u=E.data==="F!";break e}}Jn(u)}u=!1}u&&(i=a[0])}}return a=ei(),a.memoizedState=a.baseState=i,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:O_,lastRenderedState:i},a.queue=u,a=Q_.bind(null,dt,u),u.dispatch=a,u=xf(!1),N=Tf.bind(null,dt,!1,u.queue),u=ei(),E={state:i,dispatch:null,action:s,pending:null},u.queue=E,a=RE.bind(null,dt,E,N,a),E.dispatch=a,u.memoizedState=s,[i,a,!1]}function $_(s){var i=xs();return L_(i,Wt,s)}function L_(s,i,a){if(i=Sf(s,i,O_)[0],s=Oc(wn)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var u=Vo(i)}catch(D){throw D===Ea?xc:D}else u=i;i=xs();var E=i.queue,N=E.dispatch;return a!==i.memoizedState&&(dt.flags|=2048,Ta(9,{destroy:void 0},TE.bind(null,E,a),null)),[u,N,s]}function TE(s,i){s.action=i}function I_(s){var i=xs(),a=Wt;if(a!==null)return L_(i,a,s);xs(),i=i.memoizedState,a=xs();var u=a.queue.dispatch;return a.memoizedState=s,[i,u,!1]}function Ta(s,i,a,u){return s={tag:s,create:a,deps:u,inst:i,next:null},i=dt.updateQueue,i===null&&(i=Nc(),dt.updateQueue=i),a=i.lastEffect,a===null?i.lastEffect=s.next=s:(u=a.next,a.next=s,s.next=u,i.lastEffect=s),s}function P_(){return xs().memoizedState}function Dc(s,i,a,u){var E=ei();dt.flags|=s,E.memoizedState=Ta(1|i,{destroy:void 0},a,u===void 0?null:u)}function $c(s,i,a,u){var E=xs();u=u===void 0?null:u;var N=E.memoizedState.inst;Wt!==null&&u!==null&&mf(u,Wt.memoizedState.deps)?E.memoizedState=Ta(i,N,a,u):(dt.flags|=s,E.memoizedState=Ta(1|i,N,a,u))}function B_(s,i){Dc(8390656,8,s,i)}function Ef(s,i){$c(2048,8,s,i)}function NE(s){dt.flags|=4;var i=dt.updateQueue;if(i===null)i=Nc(),dt.updateQueue=i,i.events=[s];else{var a=i.events;a===null?i.events=[s]:a.push(s)}}function H_(s){var i=xs().memoizedState;return NE({ref:i,nextImpl:s}),function(){if((Lt&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}function z_(s,i){return $c(4,2,s,i)}function U_(s,i){return $c(4,4,s,i)}function q_(s,i){if(typeof i=="function"){s=s();var a=i(s);return function(){typeof a=="function"?a():i(null)}}if(i!=null)return s=s(),i.current=s,function(){i.current=null}}function F_(s,i,a){a=a!=null?a.concat([s]):null,$c(4,4,q_.bind(null,i,s),a)}function kf(){}function V_(s,i){var a=xs();i=i===void 0?null:i;var u=a.memoizedState;return i!==null&&mf(i,u[1])?u[0]:(a.memoizedState=[s,i],s)}function W_(s,i){var a=xs();i=i===void 0?null:i;var u=a.memoizedState;if(i!==null&&mf(i,u[1]))return u[0];if(u=s(),Br){Ts(!0);try{s()}finally{Ts(!1)}}return a.memoizedState=[u,i],u}function jf(s,i,a){return a===void 0||(Sn&1073741824)!==0&&(Ct&261930)===0?s.memoizedState=i:(s.memoizedState=a,s=G0(),dt.lanes|=s,ar|=s,a)}function G_(s,i,a,u){return yi(a,i)?a:ja.current!==null?(s=jf(s,a,u),yi(s,i)||(js=!0),s):(Sn&42)===0||(Sn&1073741824)!==0&&(Ct&261930)===0?(js=!0,s.memoizedState=a):(s=G0(),dt.lanes|=s,ar|=s,i)}function K_(s,i,a,u,E){var N=se.p;se.p=N!==0&&8>N?N:8;var D=W.T,K={};W.T=K,Tf(s,!1,i,a);try{var ne=E(),fe=W.S;if(fe!==null&&fe(K,ne),ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var xe=kE(ne,u);Wo(s,i,xe,Ei(s))}else Wo(s,i,u,Ei(s))}catch(Ee){Wo(s,i,{then:function(){},status:"rejected",reason:Ee},Ei())}finally{se.p=N,D!==null&&K.types!==null&&(D.types=K.types),W.T=D}}function ME(){}function Af(s,i,a,u){if(s.tag!==5)throw Error(r(476));var E=Y_(s).queue;K_(s,E,i,ee,a===null?ME:function(){return X_(s),a(u)})}function Y_(s){var i=s.memoizedState;if(i!==null)return i;i={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wn,lastRenderedState:ee},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wn,lastRenderedState:a},next:null},s.memoizedState=i,s=s.alternate,s!==null&&(s.memoizedState=i),i}function X_(s){var i=Y_(s);i.next===null&&(i=s.alternate.memoizedState),Wo(s,i.next.queue,{},Ei())}function Rf(){return Bs(cl)}function J_(){return xs().memoizedState}function Z_(){return xs().memoizedState}function OE(s){for(var i=s.return;i!==null;){switch(i.tag){case 24:case 3:var a=Ei();s=er(a);var u=tr(i,s,a);u!==null&&(fi(u,i,a),zo(u,i,a)),i={cache:nf()},s.payload=i;return}i=i.return}}function DE(s,i,a){var u=Ei();a={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Lc(s)?e0(i,a):(a=Wh(s,i,a,u),a!==null&&(fi(a,s,u),t0(a,i,u)))}function Q_(s,i,a){var u=Ei();Wo(s,i,a,u)}function Wo(s,i,a,u){var E={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Lc(s))e0(i,E);else{var N=s.alternate;if(s.lanes===0&&(N===null||N.lanes===0)&&(N=i.lastRenderedReducer,N!==null))try{var D=i.lastRenderedState,K=N(D,a);if(E.hasEagerState=!0,E.eagerState=K,yi(K,D))return vc(s,i,E,0),Zt===null&&mc(),!1}catch{}finally{}if(a=Wh(s,i,E,u),a!==null)return fi(a,s,u),t0(a,i,u),!0}return!1}function Tf(s,i,a,u){if(u={lane:2,revertLane:lp(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Lc(s)){if(i)throw Error(r(479))}else i=Wh(s,a,u,2),i!==null&&fi(i,s,2)}function Lc(s){var i=s.alternate;return s===dt||i!==null&&i===dt}function e0(s,i){Aa=Rc=!0;var a=s.pending;a===null?i.next=i:(i.next=a.next,a.next=i),s.pending=i}function t0(s,i,a){if((a&4194048)!==0){var u=i.lanes;u&=s.pendingLanes,a|=u,i.lanes=a,Ns(s,a)}}var Go={readContext:Bs,use:Mc,useCallback:ms,useContext:ms,useEffect:ms,useImperativeHandle:ms,useLayoutEffect:ms,useInsertionEffect:ms,useMemo:ms,useReducer:ms,useRef:ms,useState:ms,useDebugValue:ms,useDeferredValue:ms,useTransition:ms,useSyncExternalStore:ms,useId:ms,useHostTransitionStatus:ms,useFormState:ms,useActionState:ms,useOptimistic:ms,useMemoCache:ms,useCacheRefresh:ms};Go.useEffectEvent=ms;var s0={readContext:Bs,use:Mc,useCallback:function(s,i){return ei().memoizedState=[s,i===void 0?null:i],s},useContext:Bs,useEffect:B_,useImperativeHandle:function(s,i,a){a=a!=null?a.concat([s]):null,Dc(4194308,4,q_.bind(null,i,s),a)},useLayoutEffect:function(s,i){return Dc(4194308,4,s,i)},useInsertionEffect:function(s,i){Dc(4,2,s,i)},useMemo:function(s,i){var a=ei();i=i===void 0?null:i;var u=s();if(Br){Ts(!0);try{s()}finally{Ts(!1)}}return a.memoizedState=[u,i],u},useReducer:function(s,i,a){var u=ei();if(a!==void 0){var E=a(i);if(Br){Ts(!0);try{a(i)}finally{Ts(!1)}}}else E=i;return u.memoizedState=u.baseState=E,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:E},u.queue=s,s=s.dispatch=DE.bind(null,dt,s),[u.memoizedState,s]},useRef:function(s){var i=ei();return s={current:s},i.memoizedState=s},useState:function(s){s=xf(s);var i=s.queue,a=Q_.bind(null,dt,i);return i.dispatch=a,[s.memoizedState,a]},useDebugValue:kf,useDeferredValue:function(s,i){var a=ei();return jf(a,s,i)},useTransition:function(){var s=xf(!1);return s=K_.bind(null,dt,s.queue,!0,!1),ei().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,i,a){var u=dt,E=ei();if(kt){if(a===void 0)throw Error(r(407));a=a()}else{if(a=i(),Zt===null)throw Error(r(349));(Ct&127)!==0||x_(u,i,a)}E.memoizedState=a;var N={value:a,getSnapshot:i};return E.queue=N,B_(E_.bind(null,u,N,s),[s]),u.flags|=2048,Ta(9,{destroy:void 0},C_.bind(null,u,N,a,i),null),a},useId:function(){var s=ei(),i=Zt.identifierPrefix;if(kt){var a=an,u=rn;a=(u&~(1<<32-ts(u)-1)).toString(32)+a,i="_"+i+"R_"+a,a=Tc++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=jE++,i="_"+i+"r_"+a.toString(32)+"_";return s.memoizedState=i},useHostTransitionStatus:Rf,useFormState:D_,useActionState:D_,useOptimistic:function(s){var i=ei();i.memoizedState=i.baseState=s;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=a,i=Tf.bind(null,dt,!0,a),a.dispatch=i,[s,i]},useMemoCache:bf,useCacheRefresh:function(){return ei().memoizedState=OE.bind(null,dt)},useEffectEvent:function(s){var i=ei(),a={impl:s};return i.memoizedState=a,function(){if((Lt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Nf={readContext:Bs,use:Mc,useCallback:V_,useContext:Bs,useEffect:Ef,useImperativeHandle:F_,useInsertionEffect:z_,useLayoutEffect:U_,useMemo:W_,useReducer:Oc,useRef:P_,useState:function(){return Oc(wn)},useDebugValue:kf,useDeferredValue:function(s,i){var a=xs();return G_(a,Wt.memoizedState,s,i)},useTransition:function(){var s=Oc(wn)[0],i=xs().memoizedState;return[typeof s=="boolean"?s:Vo(s),i]},useSyncExternalStore:w_,useId:J_,useHostTransitionStatus:Rf,useFormState:$_,useActionState:$_,useOptimistic:function(s,i){var a=xs();return A_(a,Wt,s,i)},useMemoCache:bf,useCacheRefresh:Z_};Nf.useEffectEvent=H_;var i0={readContext:Bs,use:Mc,useCallback:V_,useContext:Bs,useEffect:Ef,useImperativeHandle:F_,useInsertionEffect:z_,useLayoutEffect:U_,useMemo:W_,useReducer:wf,useRef:P_,useState:function(){return wf(wn)},useDebugValue:kf,useDeferredValue:function(s,i){var a=xs();return Wt===null?jf(a,s,i):G_(a,Wt.memoizedState,s,i)},useTransition:function(){var s=wf(wn)[0],i=xs().memoizedState;return[typeof s=="boolean"?s:Vo(s),i]},useSyncExternalStore:w_,useId:J_,useHostTransitionStatus:Rf,useFormState:I_,useActionState:I_,useOptimistic:function(s,i){var a=xs();return Wt!==null?A_(a,Wt,s,i):(a.baseState=s,[s,a.queue.dispatch])},useMemoCache:bf,useCacheRefresh:Z_};i0.useEffectEvent=H_;function Mf(s,i,a,u){i=s.memoizedState,a=a(u,i),a=a==null?i:v({},i,a),s.memoizedState=a,s.lanes===0&&(s.updateQueue.baseState=a)}var Of={enqueueSetState:function(s,i,a){s=s._reactInternals;var u=Ei(),E=er(u);E.payload=i,a!=null&&(E.callback=a),i=tr(s,E,u),i!==null&&(fi(i,s,u),zo(i,s,u))},enqueueReplaceState:function(s,i,a){s=s._reactInternals;var u=Ei(),E=er(u);E.tag=1,E.payload=i,a!=null&&(E.callback=a),i=tr(s,E,u),i!==null&&(fi(i,s,u),zo(i,s,u))},enqueueForceUpdate:function(s,i){s=s._reactInternals;var a=Ei(),u=er(a);u.tag=2,i!=null&&(u.callback=i),i=tr(s,u,a),i!==null&&(fi(i,s,a),zo(i,s,a))}};function n0(s,i,a,u,E,N,D){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(u,N,D):i.prototype&&i.prototype.isPureReactComponent?!Oo(a,u)||!Oo(E,N):!0}function r0(s,i,a,u){s=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(a,u),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(a,u),i.state!==s&&Of.enqueueReplaceState(i,i.state,null)}function Hr(s,i){var a=i;if("ref"in i){a={};for(var u in i)u!=="ref"&&(a[u]=i[u])}if(s=s.defaultProps){a===i&&(a=v({},a));for(var E in s)a[E]===void 0&&(a[E]=s[E])}return a}function a0(s){pc(s)}function o0(s){console.error(s)}function l0(s){pc(s)}function Ic(s,i){try{var a=s.onUncaughtError;a(i.value,{componentStack:i.stack})}catch(u){setTimeout(function(){throw u})}}function c0(s,i,a){try{var u=s.onCaughtError;u(a.value,{componentStack:a.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(E){setTimeout(function(){throw E})}}function Df(s,i,a){return a=er(a),a.tag=3,a.payload={element:null},a.callback=function(){Ic(s,i)},a}function u0(s){return s=er(s),s.tag=3,s}function d0(s,i,a,u){var E=a.type.getDerivedStateFromError;if(typeof E=="function"){var N=u.value;s.payload=function(){return E(N)},s.callback=function(){c0(i,a,u)}}var D=a.stateNode;D!==null&&typeof D.componentDidCatch=="function"&&(s.callback=function(){c0(i,a,u),typeof E!="function"&&(or===null?or=new Set([this]):or.add(this));var K=u.stack;this.componentDidCatch(u.value,{componentStack:K!==null?K:""})})}function $E(s,i,a,u,E){if(a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(i=a.alternate,i!==null&&wa(i,a,E,!0),a=Si.current,a!==null){switch(a.tag){case 31:case 13:return Hi===null?Yc():a.alternate===null&&vs===0&&(vs=3),a.flags&=-257,a.flags|=65536,a.lanes=E,u===Cc?a.flags|=16384:(i=a.updateQueue,i===null?a.updateQueue=new Set([u]):i.add(u),rp(s,u,E)),!1;case 22:return a.flags|=65536,u===Cc?a.flags|=16384:(i=a.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([u])},a.updateQueue=i):(a=i.retryQueue,a===null?i.retryQueue=new Set([u]):a.add(u)),rp(s,u,E)),!1}throw Error(r(435,a.tag))}return rp(s,u,E),Yc(),!1}if(kt)return i=Si.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=E,u!==Zh&&(s=Error(r(422),{cause:u}),Lo(Li(s,a)))):(u!==Zh&&(i=Error(r(423),{cause:u}),Lo(Li(i,a))),s=s.current.alternate,s.flags|=65536,E&=-E,s.lanes|=E,u=Li(u,a),E=Df(s.stateNode,u,E),uf(s,E),vs!==4&&(vs=2)),!1;var N=Error(r(520),{cause:u});if(N=Li(N,a),tl===null?tl=[N]:tl.push(N),vs!==4&&(vs=2),i===null)return!0;u=Li(u,a),a=i;do{switch(a.tag){case 3:return a.flags|=65536,s=E&-E,a.lanes|=s,s=Df(a.stateNode,u,s),uf(a,s),!1;case 1:if(i=a.type,N=a.stateNode,(a.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||N!==null&&typeof N.componentDidCatch=="function"&&(or===null||!or.has(N))))return a.flags|=65536,E&=-E,a.lanes|=E,E=u0(E),d0(E,s,a,u),uf(a,E),!1}a=a.return}while(a!==null);return!1}var $f=Error(r(461)),js=!1;function Hs(s,i,a,u){i.child=s===null?m_(i,null,a,u):Pr(i,s.child,a,u)}function h0(s,i,a,u,E){a=a.render;var N=i.ref;if("ref"in u){var D={};for(var K in u)K!=="ref"&&(D[K]=u[K])}else D=u;return Dr(i),u=vf(s,i,a,D,N,E),K=gf(),s!==null&&!js?(_f(s,i,E),xn(s,i,E)):(kt&&K&&Xh(i),i.flags|=1,Hs(s,i,u,E),i.child)}function f0(s,i,a,u,E){if(s===null){var N=a.type;return typeof N=="function"&&!Gh(N)&&N.defaultProps===void 0&&a.compare===null?(i.tag=15,i.type=N,p0(s,i,N,u,E)):(s=_c(a.type,null,u,i,i.mode,E),s.ref=i.ref,s.return=i,i.child=s)}if(N=s.child,!qf(s,E)){var D=N.memoizedProps;if(a=a.compare,a=a!==null?a:Oo,a(D,u)&&s.ref===i.ref)return xn(s,i,E)}return i.flags|=1,s=gn(N,u),s.ref=i.ref,s.return=i,i.child=s}function p0(s,i,a,u,E){if(s!==null){var N=s.memoizedProps;if(Oo(N,u)&&s.ref===i.ref)if(js=!1,i.pendingProps=u=N,qf(s,E))(s.flags&131072)!==0&&(js=!0);else return i.lanes=s.lanes,xn(s,i,E)}return Lf(s,i,a,u,E)}function m0(s,i,a,u){var E=u.children,N=s!==null?s.memoizedState:null;if(s===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((i.flags&128)!==0){if(N=N!==null?N.baseLanes|a:a,s!==null){for(u=i.child=s.child,E=0;u!==null;)E=E|u.lanes|u.childLanes,u=u.sibling;u=E&~N}else u=0,i.child=null;return v0(s,i,N,a,u)}if((a&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},s!==null&&wc(i,N!==null?N.cachePool:null),N!==null?__(i,N):hf(),y_(i);else return u=i.lanes=536870912,v0(s,i,N!==null?N.baseLanes|a:a,a,u)}else N!==null?(wc(i,N.cachePool),__(i,N),ir(),i.memoizedState=null):(s!==null&&wc(i,null),hf(),ir());return Hs(s,i,E,a),i.child}function Ko(s,i){return s!==null&&s.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function v0(s,i,a,u,E){var N=af();return N=N===null?null:{parent:Es._currentValue,pool:N},i.memoizedState={baseLanes:a,cachePool:N},s!==null&&wc(i,null),hf(),y_(i),s!==null&&wa(s,i,u,!0),i.childLanes=E,null}function Pc(s,i){return i=Hc({mode:i.mode,children:i.children},s.mode),i.ref=s.ref,s.child=i,i.return=s,i}function g0(s,i,a){return Pr(i,s.child,null,a),s=Pc(i,i.pendingProps),s.flags|=2,wi(i),i.memoizedState=null,s}function LE(s,i,a){var u=i.pendingProps,E=(i.flags&128)!==0;if(i.flags&=-129,s===null){if(kt){if(u.mode==="hidden")return s=Pc(i,u),i.lanes=536870912,Ko(null,s);if(pf(i),(s=ns)?(s=Ry(s,Bi),s=s!==null&&s.data==="&"?s:null,s!==null&&(i.memoizedState={dehydrated:s,treeContext:Yn!==null?{id:rn,overflow:an}:null,retryLane:536870912,hydrationErrors:null},a=e_(s),a.return=i,i.child=a,Ps=i,ns=null)):s=null,s===null)throw Jn(i);return i.lanes=536870912,null}return Pc(i,u)}var N=s.memoizedState;if(N!==null){var D=N.dehydrated;if(pf(i),E)if(i.flags&256)i.flags&=-257,i=g0(s,i,a);else if(i.memoizedState!==null)i.child=s.child,i.flags|=128,i=null;else throw Error(r(558));else if(js||wa(s,i,a,!1),E=(a&s.childLanes)!==0,js||E){if(u=Zt,u!==null&&(D=gi(u,a),D!==0&&D!==N.retryLane))throw N.retryLane=D,Tr(s,D),fi(u,s,D),$f;Yc(),i=g0(s,i,a)}else s=N.treeContext,ns=zi(D.nextSibling),Ps=i,kt=!0,Xn=null,Bi=!1,s!==null&&i_(i,s),i=Pc(i,u),i.flags|=4096;return i}return s=gn(s.child,{mode:u.mode,children:u.children}),s.ref=i.ref,i.child=s,s.return=i,s}function Bc(s,i){var a=i.ref;if(a===null)s!==null&&s.ref!==null&&(i.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(s===null||s.ref!==a)&&(i.flags|=4194816)}}function Lf(s,i,a,u,E){return Dr(i),a=vf(s,i,a,u,void 0,E),u=gf(),s!==null&&!js?(_f(s,i,E),xn(s,i,E)):(kt&&u&&Xh(i),i.flags|=1,Hs(s,i,a,E),i.child)}function _0(s,i,a,u,E,N){return Dr(i),i.updateQueue=null,a=S_(i,u,a,E),b_(s),u=gf(),s!==null&&!js?(_f(s,i,N),xn(s,i,N)):(kt&&u&&Xh(i),i.flags|=1,Hs(s,i,a,N),i.child)}function y0(s,i,a,u,E){if(Dr(i),i.stateNode===null){var N=_a,D=a.contextType;typeof D=="object"&&D!==null&&(N=Bs(D)),N=new a(u,N),i.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,N.updater=Of,i.stateNode=N,N._reactInternals=i,N=i.stateNode,N.props=u,N.state=i.memoizedState,N.refs={},lf(i),D=a.contextType,N.context=typeof D=="object"&&D!==null?Bs(D):_a,N.state=i.memoizedState,D=a.getDerivedStateFromProps,typeof D=="function"&&(Mf(i,a,D,u),N.state=i.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof N.getSnapshotBeforeUpdate=="function"||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(D=N.state,typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount(),D!==N.state&&Of.enqueueReplaceState(N,N.state,null),qo(i,u,N,E),Uo(),N.state=i.memoizedState),typeof N.componentDidMount=="function"&&(i.flags|=4194308),u=!0}else if(s===null){N=i.stateNode;var K=i.memoizedProps,ne=Hr(a,K);N.props=ne;var fe=N.context,xe=a.contextType;D=_a,typeof xe=="object"&&xe!==null&&(D=Bs(xe));var Ee=a.getDerivedStateFromProps;xe=typeof Ee=="function"||typeof N.getSnapshotBeforeUpdate=="function",K=i.pendingProps!==K,xe||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(K||fe!==D)&&r0(i,N,u,D),Qn=!1;var pe=i.memoizedState;N.state=pe,qo(i,u,N,E),Uo(),fe=i.memoizedState,K||pe!==fe||Qn?(typeof Ee=="function"&&(Mf(i,a,Ee,u),fe=i.memoizedState),(ne=Qn||n0(i,a,ne,u,pe,fe,D))?(xe||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount()),typeof N.componentDidMount=="function"&&(i.flags|=4194308)):(typeof N.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=u,i.memoizedState=fe),N.props=u,N.state=fe,N.context=D,u=ne):(typeof N.componentDidMount=="function"&&(i.flags|=4194308),u=!1)}else{N=i.stateNode,cf(s,i),D=i.memoizedProps,xe=Hr(a,D),N.props=xe,Ee=i.pendingProps,pe=N.context,fe=a.contextType,ne=_a,typeof fe=="object"&&fe!==null&&(ne=Bs(fe)),K=a.getDerivedStateFromProps,(fe=typeof K=="function"||typeof N.getSnapshotBeforeUpdate=="function")||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(D!==Ee||pe!==ne)&&r0(i,N,u,ne),Qn=!1,pe=i.memoizedState,N.state=pe,qo(i,u,N,E),Uo();var ye=i.memoizedState;D!==Ee||pe!==ye||Qn||s!==null&&s.dependencies!==null&&bc(s.dependencies)?(typeof K=="function"&&(Mf(i,a,K,u),ye=i.memoizedState),(xe=Qn||n0(i,a,xe,u,pe,ye,ne)||s!==null&&s.dependencies!==null&&bc(s.dependencies))?(fe||typeof N.UNSAFE_componentWillUpdate!="function"&&typeof N.componentWillUpdate!="function"||(typeof N.componentWillUpdate=="function"&&N.componentWillUpdate(u,ye,ne),typeof N.UNSAFE_componentWillUpdate=="function"&&N.UNSAFE_componentWillUpdate(u,ye,ne)),typeof N.componentDidUpdate=="function"&&(i.flags|=4),typeof N.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof N.componentDidUpdate!="function"||D===s.memoizedProps&&pe===s.memoizedState||(i.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||D===s.memoizedProps&&pe===s.memoizedState||(i.flags|=1024),i.memoizedProps=u,i.memoizedState=ye),N.props=u,N.state=ye,N.context=ne,u=xe):(typeof N.componentDidUpdate!="function"||D===s.memoizedProps&&pe===s.memoizedState||(i.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||D===s.memoizedProps&&pe===s.memoizedState||(i.flags|=1024),u=!1)}return N=u,Bc(s,i),u=(i.flags&128)!==0,N||u?(N=i.stateNode,a=u&&typeof a.getDerivedStateFromError!="function"?null:N.render(),i.flags|=1,s!==null&&u?(i.child=Pr(i,s.child,null,E),i.child=Pr(i,null,a,E)):Hs(s,i,a,E),i.memoizedState=N.state,s=i.child):s=xn(s,i,E),s}function b0(s,i,a,u){return Mr(),i.flags|=256,Hs(s,i,a,u),i.child}var If={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Pf(s){return{baseLanes:s,cachePool:c_()}}function Bf(s,i,a){return s=s!==null?s.childLanes&~a:0,i&&(s|=Ci),s}function S0(s,i,a){var u=i.pendingProps,E=!1,N=(i.flags&128)!==0,D;if((D=N)||(D=s!==null&&s.memoizedState===null?!1:(ws.current&2)!==0),D&&(E=!0,i.flags&=-129),D=(i.flags&32)!==0,i.flags&=-33,s===null){if(kt){if(E?sr(i):ir(),(s=ns)?(s=Ry(s,Bi),s=s!==null&&s.data!=="&"?s:null,s!==null&&(i.memoizedState={dehydrated:s,treeContext:Yn!==null?{id:rn,overflow:an}:null,retryLane:536870912,hydrationErrors:null},a=e_(s),a.return=i,i.child=a,Ps=i,ns=null)):s=null,s===null)throw Jn(i);return Sp(s)?i.lanes=32:i.lanes=536870912,null}var K=u.children;return u=u.fallback,E?(ir(),E=i.mode,K=Hc({mode:"hidden",children:K},E),u=Nr(u,E,a,null),K.return=i,u.return=i,K.sibling=u,i.child=K,u=i.child,u.memoizedState=Pf(a),u.childLanes=Bf(s,D,a),i.memoizedState=If,Ko(null,u)):(sr(i),Hf(i,K))}var ne=s.memoizedState;if(ne!==null&&(K=ne.dehydrated,K!==null)){if(N)i.flags&256?(sr(i),i.flags&=-257,i=zf(s,i,a)):i.memoizedState!==null?(ir(),i.child=s.child,i.flags|=128,i=null):(ir(),K=u.fallback,E=i.mode,u=Hc({mode:"visible",children:u.children},E),K=Nr(K,E,a,null),K.flags|=2,u.return=i,K.return=i,u.sibling=K,i.child=u,Pr(i,s.child,null,a),u=i.child,u.memoizedState=Pf(a),u.childLanes=Bf(s,D,a),i.memoizedState=If,i=Ko(null,u));else if(sr(i),Sp(K)){if(D=K.nextSibling&&K.nextSibling.dataset,D)var fe=D.dgst;D=fe,u=Error(r(419)),u.stack="",u.digest=D,Lo({value:u,source:null,stack:null}),i=zf(s,i,a)}else if(js||wa(s,i,a,!1),D=(a&s.childLanes)!==0,js||D){if(D=Zt,D!==null&&(u=gi(D,a),u!==0&&u!==ne.retryLane))throw ne.retryLane=u,Tr(s,u),fi(D,s,u),$f;bp(K)||Yc(),i=zf(s,i,a)}else bp(K)?(i.flags|=192,i.child=s.child,i=null):(s=ne.treeContext,ns=zi(K.nextSibling),Ps=i,kt=!0,Xn=null,Bi=!1,s!==null&&i_(i,s),i=Hf(i,u.children),i.flags|=4096);return i}return E?(ir(),K=u.fallback,E=i.mode,ne=s.child,fe=ne.sibling,u=gn(ne,{mode:"hidden",children:u.children}),u.subtreeFlags=ne.subtreeFlags&65011712,fe!==null?K=gn(fe,K):(K=Nr(K,E,a,null),K.flags|=2),K.return=i,u.return=i,u.sibling=K,i.child=u,Ko(null,u),u=i.child,K=s.child.memoizedState,K===null?K=Pf(a):(E=K.cachePool,E!==null?(ne=Es._currentValue,E=E.parent!==ne?{parent:ne,pool:ne}:E):E=c_(),K={baseLanes:K.baseLanes|a,cachePool:E}),u.memoizedState=K,u.childLanes=Bf(s,D,a),i.memoizedState=If,Ko(s.child,u)):(sr(i),a=s.child,s=a.sibling,a=gn(a,{mode:"visible",children:u.children}),a.return=i,a.sibling=null,s!==null&&(D=i.deletions,D===null?(i.deletions=[s],i.flags|=16):D.push(s)),i.child=a,i.memoizedState=null,a)}function Hf(s,i){return i=Hc({mode:"visible",children:i},s.mode),i.return=s,s.child=i}function Hc(s,i){return s=bi(22,s,null,i),s.lanes=0,s}function zf(s,i,a){return Pr(i,s.child,null,a),s=Hf(i,i.pendingProps.children),s.flags|=2,i.memoizedState=null,s}function w0(s,i,a){s.lanes|=i;var u=s.alternate;u!==null&&(u.lanes|=i),tf(s.return,i,a)}function Uf(s,i,a,u,E,N){var D=s.memoizedState;D===null?s.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:u,tail:a,tailMode:E,treeForkCount:N}:(D.isBackwards=i,D.rendering=null,D.renderingStartTime=0,D.last=u,D.tail=a,D.tailMode=E,D.treeForkCount=N)}function x0(s,i,a){var u=i.pendingProps,E=u.revealOrder,N=u.tail;u=u.children;var D=ws.current,K=(D&2)!==0;if(K?(D=D&1|2,i.flags|=128):D&=1,z(ws,D),Hs(s,i,u,a),u=kt?$o:0,!K&&s!==null&&(s.flags&128)!==0)e:for(s=i.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&w0(s,a,i);else if(s.tag===19)w0(s,a,i);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(E){case"forwards":for(a=i.child,E=null;a!==null;)s=a.alternate,s!==null&&Ac(s)===null&&(E=a),a=a.sibling;a=E,a===null?(E=i.child,i.child=null):(E=a.sibling,a.sibling=null),Uf(i,!1,E,a,N,u);break;case"backwards":case"unstable_legacy-backwards":for(a=null,E=i.child,i.child=null;E!==null;){if(s=E.alternate,s!==null&&Ac(s)===null){i.child=E;break}s=E.sibling,E.sibling=a,a=E,E=s}Uf(i,!0,a,null,N,u);break;case"together":Uf(i,!1,null,null,void 0,u);break;default:i.memoizedState=null}return i.child}function xn(s,i,a){if(s!==null&&(i.dependencies=s.dependencies),ar|=i.lanes,(a&i.childLanes)===0)if(s!==null){if(wa(s,i,a,!1),(a&i.childLanes)===0)return null}else return null;if(s!==null&&i.child!==s.child)throw Error(r(153));if(i.child!==null){for(s=i.child,a=gn(s,s.pendingProps),i.child=a,a.return=i;s.sibling!==null;)s=s.sibling,a=a.sibling=gn(s,s.pendingProps),a.return=i;a.sibling=null}return i.child}function qf(s,i){return(s.lanes&i)!==0?!0:(s=s.dependencies,!!(s!==null&&bc(s)))}function IE(s,i,a){switch(i.tag){case 3:V(i,i.stateNode.containerInfo),Zn(i,Es,s.memoizedState.cache),Mr();break;case 27:case 5:ae(i);break;case 4:V(i,i.stateNode.containerInfo);break;case 10:Zn(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,pf(i),null;break;case 13:var u=i.memoizedState;if(u!==null)return u.dehydrated!==null?(sr(i),i.flags|=128,null):(a&i.child.childLanes)!==0?S0(s,i,a):(sr(i),s=xn(s,i,a),s!==null?s.sibling:null);sr(i);break;case 19:var E=(s.flags&128)!==0;if(u=(a&i.childLanes)!==0,u||(wa(s,i,a,!1),u=(a&i.childLanes)!==0),E){if(u)return x0(s,i,a);i.flags|=128}if(E=i.memoizedState,E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),z(ws,ws.current),u)break;return null;case 22:return i.lanes=0,m0(s,i,a,i.pendingProps);case 24:Zn(i,Es,s.memoizedState.cache)}return xn(s,i,a)}function C0(s,i,a){if(s!==null)if(s.memoizedProps!==i.pendingProps)js=!0;else{if(!qf(s,a)&&(i.flags&128)===0)return js=!1,IE(s,i,a);js=(s.flags&131072)!==0}else js=!1,kt&&(i.flags&1048576)!==0&&s_(i,$o,i.index);switch(i.lanes=0,i.tag){case 16:e:{var u=i.pendingProps;if(s=Lr(i.elementType),i.type=s,typeof s=="function")Gh(s)?(u=Hr(s,u),i.tag=1,i=y0(null,i,s,u,a)):(i.tag=0,i=Lf(null,i,s,u,a));else{if(s!=null){var E=s.$$typeof;if(E===k){i.tag=11,i=h0(null,i,s,u,a);break e}else if(E===T){i.tag=14,i=f0(null,i,s,u,a);break e}}throw i=J(s)||s,Error(r(306,i,""))}}return i;case 0:return Lf(s,i,i.type,i.pendingProps,a);case 1:return u=i.type,E=Hr(u,i.pendingProps),y0(s,i,u,E,a);case 3:e:{if(V(i,i.stateNode.containerInfo),s===null)throw Error(r(387));u=i.pendingProps;var N=i.memoizedState;E=N.element,cf(s,i),qo(i,u,null,a);var D=i.memoizedState;if(u=D.cache,Zn(i,Es,u),u!==N.cache&&sf(i,[Es],a,!0),Uo(),u=D.element,N.isDehydrated)if(N={element:u,isDehydrated:!1,cache:D.cache},i.updateQueue.baseState=N,i.memoizedState=N,i.flags&256){i=b0(s,i,u,a);break e}else if(u!==E){E=Li(Error(r(424)),i),Lo(E),i=b0(s,i,u,a);break e}else{switch(s=i.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(ns=zi(s.firstChild),Ps=i,kt=!0,Xn=null,Bi=!0,a=m_(i,null,u,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Mr(),u===E){i=xn(s,i,a);break e}Hs(s,i,u,a)}i=i.child}return i;case 26:return Bc(s,i),s===null?(a=$y(i.type,null,i.pendingProps,null))?i.memoizedState=a:kt||(a=i.type,s=i.pendingProps,u=su(ie.current).createElement(a),u[ve]=i,u[Se]=s,zs(u,a,s),ot(u),i.stateNode=u):i.memoizedState=$y(i.type,s.memoizedProps,i.pendingProps,s.memoizedState),null;case 27:return ae(i),s===null&&kt&&(u=i.stateNode=My(i.type,i.pendingProps,ie.current),Ps=i,Bi=!0,E=ns,dr(i.type)?(wp=E,ns=zi(u.firstChild)):ns=E),Hs(s,i,i.pendingProps.children,a),Bc(s,i),s===null&&(i.flags|=4194304),i.child;case 5:return s===null&&kt&&((E=u=ns)&&(u=fk(u,i.type,i.pendingProps,Bi),u!==null?(i.stateNode=u,Ps=i,ns=zi(u.firstChild),Bi=!1,E=!0):E=!1),E||Jn(i)),ae(i),E=i.type,N=i.pendingProps,D=s!==null?s.memoizedProps:null,u=N.children,gp(E,N)?u=null:D!==null&&gp(E,D)&&(i.flags|=32),i.memoizedState!==null&&(E=vf(s,i,AE,null,null,a),cl._currentValue=E),Bc(s,i),Hs(s,i,u,a),i.child;case 6:return s===null&&kt&&((s=a=ns)&&(a=pk(a,i.pendingProps,Bi),a!==null?(i.stateNode=a,Ps=i,ns=null,s=!0):s=!1),s||Jn(i)),null;case 13:return S0(s,i,a);case 4:return V(i,i.stateNode.containerInfo),u=i.pendingProps,s===null?i.child=Pr(i,null,u,a):Hs(s,i,u,a),i.child;case 11:return h0(s,i,i.type,i.pendingProps,a);case 7:return Hs(s,i,i.pendingProps,a),i.child;case 8:return Hs(s,i,i.pendingProps.children,a),i.child;case 12:return Hs(s,i,i.pendingProps.children,a),i.child;case 10:return u=i.pendingProps,Zn(i,i.type,u.value),Hs(s,i,u.children,a),i.child;case 9:return E=i.type._context,u=i.pendingProps.children,Dr(i),E=Bs(E),u=u(E),i.flags|=1,Hs(s,i,u,a),i.child;case 14:return f0(s,i,i.type,i.pendingProps,a);case 15:return p0(s,i,i.type,i.pendingProps,a);case 19:return x0(s,i,a);case 31:return LE(s,i,a);case 22:return m0(s,i,a,i.pendingProps);case 24:return Dr(i),u=Bs(Es),s===null?(E=af(),E===null&&(E=Zt,N=nf(),E.pooledCache=N,N.refCount++,N!==null&&(E.pooledCacheLanes|=a),E=N),i.memoizedState={parent:u,cache:E},lf(i),Zn(i,Es,E)):((s.lanes&a)!==0&&(cf(s,i),qo(i,null,null,a),Uo()),E=s.memoizedState,N=i.memoizedState,E.parent!==u?(E={parent:u,cache:u},i.memoizedState=E,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=E),Zn(i,Es,u)):(u=N.cache,Zn(i,Es,u),u!==E.cache&&sf(i,[Es],a,!0))),Hs(s,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(r(156,i.tag))}function Cn(s){s.flags|=4}function Ff(s,i,a,u,E){if((i=(s.mode&32)!==0)&&(i=!1),i){if(s.flags|=16777216,(E&335544128)===E)if(s.stateNode.complete)s.flags|=8192;else if(J0())s.flags|=8192;else throw Ir=Cc,of}else s.flags&=-16777217}function E0(s,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Hy(i))if(J0())s.flags|=8192;else throw Ir=Cc,of}function zc(s,i){i!==null&&(s.flags|=4),s.flags&16384&&(i=s.tag!==22?st():536870912,s.lanes|=i,Da|=i)}function Yo(s,i){if(!kt)switch(s.tailMode){case"hidden":i=s.tail;for(var a=null;i!==null;)i.alternate!==null&&(a=i),i=i.sibling;a===null?s.tail=null:a.sibling=null;break;case"collapsed":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?i||s.tail===null?s.tail=null:s.tail.sibling=null:u.sibling=null}}function rs(s){var i=s.alternate!==null&&s.alternate.child===s.child,a=0,u=0;if(i)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,i}function PE(s,i,a){var u=i.pendingProps;switch(Jh(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return rs(i),null;case 1:return rs(i),null;case 3:return a=i.stateNode,u=null,s!==null&&(u=s.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),bn(Es),ce(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(s===null||s.child===null)&&(Sa(i)?Cn(i):s===null||s.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Qh())),rs(i),null;case 26:var E=i.type,N=i.memoizedState;return s===null?(Cn(i),N!==null?(rs(i),E0(i,N)):(rs(i),Ff(i,E,null,u,a))):N?N!==s.memoizedState?(Cn(i),rs(i),E0(i,N)):(rs(i),i.flags&=-16777217):(s=s.memoizedProps,s!==u&&Cn(i),rs(i),Ff(i,E,s,u,a)),null;case 27:if(Y(i),a=ie.current,E=i.type,s!==null&&i.stateNode!=null)s.memoizedProps!==u&&Cn(i);else{if(!u){if(i.stateNode===null)throw Error(r(166));return rs(i),null}s=I.current,Sa(i)?n_(i):(s=My(E,u,a),i.stateNode=s,Cn(i))}return rs(i),null;case 5:if(Y(i),E=i.type,s!==null&&i.stateNode!=null)s.memoizedProps!==u&&Cn(i);else{if(!u){if(i.stateNode===null)throw Error(r(166));return rs(i),null}if(N=I.current,Sa(i))n_(i);else{var D=su(ie.current);switch(N){case 1:N=D.createElementNS("http://www.w3.org/2000/svg",E);break;case 2:N=D.createElementNS("http://www.w3.org/1998/Math/MathML",E);break;default:switch(E){case"svg":N=D.createElementNS("http://www.w3.org/2000/svg",E);break;case"math":N=D.createElementNS("http://www.w3.org/1998/Math/MathML",E);break;case"script":N=D.createElement("div"),N.innerHTML="<script><\/script>",N=N.removeChild(N.firstChild);break;case"select":N=typeof u.is=="string"?D.createElement("select",{is:u.is}):D.createElement("select"),u.multiple?N.multiple=!0:u.size&&(N.size=u.size);break;default:N=typeof u.is=="string"?D.createElement(E,{is:u.is}):D.createElement(E)}}N[ve]=i,N[Se]=u;e:for(D=i.child;D!==null;){if(D.tag===5||D.tag===6)N.appendChild(D.stateNode);else if(D.tag!==4&&D.tag!==27&&D.child!==null){D.child.return=D,D=D.child;continue}if(D===i)break e;for(;D.sibling===null;){if(D.return===null||D.return===i)break e;D=D.return}D.sibling.return=D.return,D=D.sibling}i.stateNode=N;e:switch(zs(N,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&&Cn(i)}}return rs(i),Ff(i,i.type,s===null?null:s.memoizedProps,i.pendingProps,a),null;case 6:if(s&&i.stateNode!=null)s.memoizedProps!==u&&Cn(i);else{if(typeof u!="string"&&i.stateNode===null)throw Error(r(166));if(s=ie.current,Sa(i)){if(s=i.stateNode,a=i.memoizedProps,u=null,E=Ps,E!==null)switch(E.tag){case 27:case 5:u=E.memoizedProps}s[ve]=i,s=!!(s.nodeValue===a||u!==null&&u.suppressHydrationWarning===!0||Sy(s.nodeValue,a)),s||Jn(i,!0)}else s=su(s).createTextNode(u),s[ve]=i,i.stateNode=s}return rs(i),null;case 31:if(a=i.memoizedState,s===null||s.memoizedState!==null){if(u=Sa(i),a!==null){if(s===null){if(!u)throw Error(r(318));if(s=i.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[ve]=i}else Mr(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;rs(i),s=!1}else a=Qh(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=a),s=!0;if(!s)return i.flags&256?(wi(i),i):(wi(i),null);if((i.flags&128)!==0)throw Error(r(558))}return rs(i),null;case 13:if(u=i.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(E=Sa(i),u!==null&&u.dehydrated!==null){if(s===null){if(!E)throw Error(r(318));if(E=i.memoizedState,E=E!==null?E.dehydrated:null,!E)throw Error(r(317));E[ve]=i}else Mr(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;rs(i),E=!1}else E=Qh(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=E),E=!0;if(!E)return i.flags&256?(wi(i),i):(wi(i),null)}return wi(i),(i.flags&128)!==0?(i.lanes=a,i):(a=u!==null,s=s!==null&&s.memoizedState!==null,a&&(u=i.child,E=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(E=u.alternate.memoizedState.cachePool.pool),N=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(N=u.memoizedState.cachePool.pool),N!==E&&(u.flags|=2048)),a!==s&&a&&(i.child.flags|=8192),zc(i,i.updateQueue),rs(i),null);case 4:return ce(),s===null&&hp(i.stateNode.containerInfo),rs(i),null;case 10:return bn(i.type),rs(i),null;case 19:if(P(ws),u=i.memoizedState,u===null)return rs(i),null;if(E=(i.flags&128)!==0,N=u.rendering,N===null)if(E)Yo(u,!1);else{if(vs!==0||s!==null&&(s.flags&128)!==0)for(s=i.child;s!==null;){if(N=Ac(s),N!==null){for(i.flags|=128,Yo(u,!1),s=N.updateQueue,i.updateQueue=s,zc(i,s),i.subtreeFlags=0,s=a,a=i.child;a!==null;)Qg(a,s),a=a.sibling;return z(ws,ws.current&1|2),kt&&_n(i,u.treeForkCount),i.child}s=s.sibling}u.tail!==null&&Ke()>Wc&&(i.flags|=128,E=!0,Yo(u,!1),i.lanes=4194304)}else{if(!E)if(s=Ac(N),s!==null){if(i.flags|=128,E=!0,s=s.updateQueue,i.updateQueue=s,zc(i,s),Yo(u,!0),u.tail===null&&u.tailMode==="hidden"&&!N.alternate&&!kt)return rs(i),null}else 2*Ke()-u.renderingStartTime>Wc&&a!==536870912&&(i.flags|=128,E=!0,Yo(u,!1),i.lanes=4194304);u.isBackwards?(N.sibling=i.child,i.child=N):(s=u.last,s!==null?s.sibling=N:i.child=N,u.last=N)}return u.tail!==null?(s=u.tail,u.rendering=s,u.tail=s.sibling,u.renderingStartTime=Ke(),s.sibling=null,a=ws.current,z(ws,E?a&1|2:a&1),kt&&_n(i,u.treeForkCount),s):(rs(i),null);case 22:case 23:return wi(i),ff(),u=i.memoizedState!==null,s!==null?s.memoizedState!==null!==u&&(i.flags|=8192):u&&(i.flags|=8192),u?(a&536870912)!==0&&(i.flags&128)===0&&(rs(i),i.subtreeFlags&6&&(i.flags|=8192)):rs(i),a=i.updateQueue,a!==null&&zc(i,a.retryQueue),a=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),u=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(u=i.memoizedState.cachePool.pool),u!==a&&(i.flags|=2048),s!==null&&P($r),null;case 24:return a=null,s!==null&&(a=s.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),bn(Es),rs(i),null;case 25:return null;case 30:return null}throw Error(r(156,i.tag))}function BE(s,i){switch(Jh(i),i.tag){case 1:return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 3:return bn(Es),ce(),s=i.flags,(s&65536)!==0&&(s&128)===0?(i.flags=s&-65537|128,i):null;case 26:case 27:case 5:return Y(i),null;case 31:if(i.memoizedState!==null){if(wi(i),i.alternate===null)throw Error(r(340));Mr()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 13:if(wi(i),s=i.memoizedState,s!==null&&s.dehydrated!==null){if(i.alternate===null)throw Error(r(340));Mr()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 19:return P(ws),null;case 4:return ce(),null;case 10:return bn(i.type),null;case 22:case 23:return wi(i),ff(),s!==null&&P($r),s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 24:return bn(Es),null;case 25:return null;default:return null}}function k0(s,i){switch(Jh(i),i.tag){case 3:bn(Es),ce();break;case 26:case 27:case 5:Y(i);break;case 4:ce();break;case 31:i.memoizedState!==null&&wi(i);break;case 13:wi(i);break;case 19:P(ws);break;case 10:bn(i.type);break;case 22:case 23:wi(i),ff(),s!==null&&P($r);break;case 24:bn(Es)}}function Xo(s,i){try{var a=i.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 N=a.create,D=a.inst;u=N(),D.destroy=u}a=a.next}while(a!==E)}}catch(K){Ht(i,i.return,K)}}function nr(s,i,a){try{var u=i.updateQueue,E=u!==null?u.lastEffect:null;if(E!==null){var N=E.next;u=N;do{if((u.tag&s)===s){var D=u.inst,K=D.destroy;if(K!==void 0){D.destroy=void 0,E=i;var ne=a,fe=K;try{fe()}catch(xe){Ht(E,ne,xe)}}}u=u.next}while(u!==N)}}catch(xe){Ht(i,i.return,xe)}}function j0(s){var i=s.updateQueue;if(i!==null){var a=s.stateNode;try{g_(i,a)}catch(u){Ht(s,s.return,u)}}}function A0(s,i,a){a.props=Hr(s.type,s.memoizedProps),a.state=s.memoizedState;try{a.componentWillUnmount()}catch(u){Ht(s,i,u)}}function Jo(s,i){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){Ht(s,i,E)}}function on(s,i){var a=s.ref,u=s.refCleanup;if(a!==null)if(typeof u=="function")try{u()}catch(E){Ht(s,i,E)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(E){Ht(s,i,E)}else a.current=null}function R0(s){var i=s.type,a=s.memoizedProps,u=s.stateNode;try{e:switch(i){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){Ht(s,s.return,E)}}function Vf(s,i,a){try{var u=s.stateNode;ok(u,s.type,a,i),u[Se]=i}catch(E){Ht(s,s.return,E)}}function T0(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&dr(s.type)||s.tag===4}function Wf(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||T0(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&&dr(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 Gf(s,i,a){var u=s.tag;if(u===5||u===6)s=s.stateNode,i?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(s,i):(i=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,i.appendChild(s),a=a._reactRootContainer,a!=null||i.onclick!==null||(i.onclick=Di));else if(u!==4&&(u===27&&dr(s.type)&&(a=s.stateNode,i=null),s=s.child,s!==null))for(Gf(s,i,a),s=s.sibling;s!==null;)Gf(s,i,a),s=s.sibling}function Uc(s,i,a){var u=s.tag;if(u===5||u===6)s=s.stateNode,i?a.insertBefore(s,i):a.appendChild(s);else if(u!==4&&(u===27&&dr(s.type)&&(a=s.stateNode),s=s.child,s!==null))for(Uc(s,i,a),s=s.sibling;s!==null;)Uc(s,i,a),s=s.sibling}function N0(s){var i=s.stateNode,a=s.memoizedProps;try{for(var u=s.type,E=i.attributes;E.length;)i.removeAttributeNode(E[0]);zs(i,u,a),i[ve]=s,i[Se]=a}catch(N){Ht(s,s.return,N)}}var En=!1,As=!1,Kf=!1,M0=typeof WeakSet=="function"?WeakSet:Set,Ls=null;function HE(s,i){if(s=s.containerInfo,mp=cu,s=Fg(s),Hh(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,N=u.focusNode;u=u.focusOffset;try{a.nodeType,N.nodeType}catch{a=null;break e}var D=0,K=-1,ne=-1,fe=0,xe=0,Ee=s,pe=null;t:for(;;){for(var ye;Ee!==a||E!==0&&Ee.nodeType!==3||(K=D+E),Ee!==N||u!==0&&Ee.nodeType!==3||(ne=D+u),Ee.nodeType===3&&(D+=Ee.nodeValue.length),(ye=Ee.firstChild)!==null;)pe=Ee,Ee=ye;for(;;){if(Ee===s)break t;if(pe===a&&++fe===E&&(K=D),pe===N&&++xe===u&&(ne=D),(ye=Ee.nextSibling)!==null)break;Ee=pe,pe=Ee.parentNode}Ee=ye}a=K===-1||ne===-1?null:{start:K,end:ne}}else a=null}a=a||{start:0,end:0}}else a=null;for(vp={focusedElem:s,selectionRange:a},cu=!1,Ls=i;Ls!==null;)if(i=Ls,s=i.child,(i.subtreeFlags&1028)!==0&&s!==null)s.return=i,Ls=s;else for(;Ls!==null;){switch(i=Ls,N=i.alternate,s=i.flags,i.tag){case 0:if((s&4)!==0&&(s=i.updateQueue,s=s!==null?s.events:null,s!==null))for(a=0;a<s.length;a++)E=s[a],E.ref.impl=E.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&N!==null){s=void 0,a=i,E=N.memoizedProps,N=N.memoizedState,u=a.stateNode;try{var Be=Hr(a.type,E);s=u.getSnapshotBeforeUpdate(Be,N),u.__reactInternalSnapshotBeforeUpdate=s}catch(We){Ht(a,a.return,We)}}break;case 3:if((s&1024)!==0){if(s=i.stateNode.containerInfo,a=s.nodeType,a===9)yp(s);else if(a===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":yp(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(r(163))}if(s=i.sibling,s!==null){s.return=i.return,Ls=s;break}Ls=i.return}}function O0(s,i,a){var u=a.flags;switch(a.tag){case 0:case 11:case 15:jn(s,a),u&4&&Xo(5,a);break;case 1:if(jn(s,a),u&4)if(s=a.stateNode,i===null)try{s.componentDidMount()}catch(D){Ht(a,a.return,D)}else{var E=Hr(a.type,i.memoizedProps);i=i.memoizedState;try{s.componentDidUpdate(E,i,s.__reactInternalSnapshotBeforeUpdate)}catch(D){Ht(a,a.return,D)}}u&64&&j0(a),u&512&&Jo(a,a.return);break;case 3:if(jn(s,a),u&64&&(s=a.updateQueue,s!==null)){if(i=null,a.child!==null)switch(a.child.tag){case 27:case 5:i=a.child.stateNode;break;case 1:i=a.child.stateNode}try{g_(s,i)}catch(D){Ht(a,a.return,D)}}break;case 27:i===null&&u&4&&N0(a);case 26:case 5:jn(s,a),i===null&&u&4&&R0(a),u&512&&Jo(a,a.return);break;case 12:jn(s,a);break;case 31:jn(s,a),u&4&&L0(s,a);break;case 13:jn(s,a),u&4&&I0(s,a),u&64&&(s=a.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(a=YE.bind(null,a),mk(s,a))));break;case 22:if(u=a.memoizedState!==null||En,!u){i=i!==null&&i.memoizedState!==null||As,E=En;var N=As;En=u,(As=i)&&!N?An(s,a,(a.subtreeFlags&8772)!==0):jn(s,a),En=E,As=N}break;case 30:break;default:jn(s,a)}}function D0(s){var i=s.alternate;i!==null&&(s.alternate=null,D0(i)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(i=s.stateNode,i!==null&&At(i)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var us=null,ci=!1;function kn(s,i,a){for(a=a.child;a!==null;)$0(s,i,a),a=a.sibling}function $0(s,i,a){if(Fe&&typeof Fe.onCommitFiberUnmount=="function")try{Fe.onCommitFiberUnmount(_s,a)}catch{}switch(a.tag){case 26:As||on(a,i),kn(s,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:As||on(a,i);var u=us,E=ci;dr(a.type)&&(us=a.stateNode,ci=!1),kn(s,i,a),al(a.stateNode),us=u,ci=E;break;case 5:As||on(a,i);case 6:if(u=us,E=ci,us=null,kn(s,i,a),us=u,ci=E,us!==null)if(ci)try{(us.nodeType===9?us.body:us.nodeName==="HTML"?us.ownerDocument.body:us).removeChild(a.stateNode)}catch(N){Ht(a,i,N)}else try{us.removeChild(a.stateNode)}catch(N){Ht(a,i,N)}break;case 18:us!==null&&(ci?(s=us,jy(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,a.stateNode),Ua(s)):jy(us,a.stateNode));break;case 4:u=us,E=ci,us=a.stateNode.containerInfo,ci=!0,kn(s,i,a),us=u,ci=E;break;case 0:case 11:case 14:case 15:nr(2,a,i),As||nr(4,a,i),kn(s,i,a);break;case 1:As||(on(a,i),u=a.stateNode,typeof u.componentWillUnmount=="function"&&A0(a,i,u)),kn(s,i,a);break;case 21:kn(s,i,a);break;case 22:As=(u=As)||a.memoizedState!==null,kn(s,i,a),As=u;break;default:kn(s,i,a)}}function L0(s,i){if(i.memoizedState===null&&(s=i.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Ua(s)}catch(a){Ht(i,i.return,a)}}}function I0(s,i){if(i.memoizedState===null&&(s=i.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Ua(s)}catch(a){Ht(i,i.return,a)}}function zE(s){switch(s.tag){case 31:case 13:case 19:var i=s.stateNode;return i===null&&(i=s.stateNode=new M0),i;case 22:return s=s.stateNode,i=s._retryCache,i===null&&(i=s._retryCache=new M0),i;default:throw Error(r(435,s.tag))}}function qc(s,i){var a=zE(s);i.forEach(function(u){if(!a.has(u)){a.add(u);var E=XE.bind(null,s,u);u.then(E,E)}})}function ui(s,i){var a=i.deletions;if(a!==null)for(var u=0;u<a.length;u++){var E=a[u],N=s,D=i,K=D;e:for(;K!==null;){switch(K.tag){case 27:if(dr(K.type)){us=K.stateNode,ci=!1;break e}break;case 5:us=K.stateNode,ci=!1;break e;case 3:case 4:us=K.stateNode.containerInfo,ci=!0;break e}K=K.return}if(us===null)throw Error(r(160));$0(N,D,E),us=null,ci=!1,N=E.alternate,N!==null&&(N.return=null),E.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)P0(i,s),i=i.sibling}var Ki=null;function P0(s,i){var a=s.alternate,u=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:ui(i,s),di(s),u&4&&(nr(3,s,s.return),Xo(3,s),nr(5,s,s.return));break;case 1:ui(i,s),di(s),u&512&&(As||a===null||on(a,a.return)),u&64&&En&&(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(ui(i,s),di(s),u&512&&(As||a===null||on(a,a.return)),u&4){var N=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":N=E.getElementsByTagName("title")[0],(!N||N[yt]||N[ve]||N.namespaceURI==="http://www.w3.org/2000/svg"||N.hasAttribute("itemprop"))&&(N=E.createElement(u),E.head.insertBefore(N,E.querySelector("head > title"))),zs(N,u,a),N[ve]=s,ot(N),u=N;break e;case"link":var D=Py("link","href",E).get(u+(a.href||""));if(D){for(var K=0;K<D.length;K++)if(N=D[K],N.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&N.getAttribute("rel")===(a.rel==null?null:a.rel)&&N.getAttribute("title")===(a.title==null?null:a.title)&&N.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){D.splice(K,1);break t}}N=E.createElement(u),zs(N,u,a),E.head.appendChild(N);break;case"meta":if(D=Py("meta","content",E).get(u+(a.content||""))){for(K=0;K<D.length;K++)if(N=D[K],N.getAttribute("content")===(a.content==null?null:""+a.content)&&N.getAttribute("name")===(a.name==null?null:a.name)&&N.getAttribute("property")===(a.property==null?null:a.property)&&N.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&N.getAttribute("charset")===(a.charSet==null?null:a.charSet)){D.splice(K,1);break t}}N=E.createElement(u),zs(N,u,a),E.head.appendChild(N);break;default:throw Error(r(468,u))}N[ve]=s,ot(N),u=N}s.stateNode=u}else By(E,s.type,s.stateNode);else s.stateNode=Iy(E,u,s.memoizedProps);else N!==u?(N===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):N.count--,u===null?By(E,s.type,s.stateNode):Iy(E,u,s.memoizedProps)):u===null&&s.stateNode!==null&&Vf(s,s.memoizedProps,a.memoizedProps)}break;case 27:ui(i,s),di(s),u&512&&(As||a===null||on(a,a.return)),a!==null&&u&4&&Vf(s,s.memoizedProps,a.memoizedProps);break;case 5:if(ui(i,s),di(s),u&512&&(As||a===null||on(a,a.return)),s.flags&32){E=s.stateNode;try{mn(E,"")}catch(Be){Ht(s,s.return,Be)}}u&4&&s.stateNode!=null&&(E=s.memoizedProps,Vf(s,E,a!==null?a.memoizedProps:E)),u&1024&&(Kf=!0);break;case 6:if(ui(i,s),di(s),u&4){if(s.stateNode===null)throw Error(r(162));u=s.memoizedProps,a=s.stateNode;try{a.nodeValue=u}catch(Be){Ht(s,s.return,Be)}}break;case 3:if(ru=null,E=Ki,Ki=iu(i.containerInfo),ui(i,s),Ki=E,di(s),u&4&&a!==null&&a.memoizedState.isDehydrated)try{Ua(i.containerInfo)}catch(Be){Ht(s,s.return,Be)}Kf&&(Kf=!1,B0(s));break;case 4:u=Ki,Ki=iu(s.stateNode.containerInfo),ui(i,s),di(s),Ki=u;break;case 12:ui(i,s),di(s);break;case 31:ui(i,s),di(s),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,qc(s,u)));break;case 13:ui(i,s),di(s),s.child.flags&8192&&s.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Vc=Ke()),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,qc(s,u)));break;case 22:E=s.memoizedState!==null;var ne=a!==null&&a.memoizedState!==null,fe=En,xe=As;if(En=fe||E,As=xe||ne,ui(i,s),As=xe,En=fe,di(s),u&8192)e:for(i=s.stateNode,i._visibility=E?i._visibility&-2:i._visibility|1,E&&(a===null||ne||En||As||zr(s)),a=null,i=s;;){if(i.tag===5||i.tag===26){if(a===null){ne=a=i;try{if(N=ne.stateNode,E)D=N.style,typeof D.setProperty=="function"?D.setProperty("display","none","important"):D.display="none";else{K=ne.stateNode;var Ee=ne.memoizedProps.style,pe=Ee!=null&&Ee.hasOwnProperty("display")?Ee.display:null;K.style.display=pe==null||typeof pe=="boolean"?"":(""+pe).trim()}}catch(Be){Ht(ne,ne.return,Be)}}}else if(i.tag===6){if(a===null){ne=i;try{ne.stateNode.nodeValue=E?"":ne.memoizedProps}catch(Be){Ht(ne,ne.return,Be)}}}else if(i.tag===18){if(a===null){ne=i;try{var ye=ne.stateNode;E?Ay(ye,!0):Ay(ne.stateNode,!1)}catch(Be){Ht(ne,ne.return,Be)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===s)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;a===i&&(a=null),i=i.return}a===i&&(a=null),i.sibling.return=i.return,i=i.sibling}u&4&&(u=s.updateQueue,u!==null&&(a=u.retryQueue,a!==null&&(u.retryQueue=null,qc(s,a))));break;case 19:ui(i,s),di(s),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,qc(s,u)));break;case 30:break;case 21:break;default:ui(i,s),di(s)}}function di(s){var i=s.flags;if(i&2){try{for(var a,u=s.return;u!==null;){if(T0(u)){a=u;break}u=u.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var E=a.stateNode,N=Wf(s);Uc(s,N,E);break;case 5:var D=a.stateNode;a.flags&32&&(mn(D,""),a.flags&=-33);var K=Wf(s);Uc(s,K,D);break;case 3:case 4:var ne=a.stateNode.containerInfo,fe=Wf(s);Gf(s,fe,ne);break;default:throw Error(r(161))}}catch(xe){Ht(s,s.return,xe)}s.flags&=-3}i&4096&&(s.flags&=-4097)}function B0(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var i=s;B0(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),s=s.sibling}}function jn(s,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)O0(s,i.alternate,i),i=i.sibling}function zr(s){for(s=s.child;s!==null;){var i=s;switch(i.tag){case 0:case 11:case 14:case 15:nr(4,i,i.return),zr(i);break;case 1:on(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&A0(i,i.return,a),zr(i);break;case 27:al(i.stateNode);case 26:case 5:on(i,i.return),zr(i);break;case 22:i.memoizedState===null&&zr(i);break;case 30:zr(i);break;default:zr(i)}s=s.sibling}}function An(s,i,a){for(a=a&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var u=i.alternate,E=s,N=i,D=N.flags;switch(N.tag){case 0:case 11:case 15:An(E,N,a),Xo(4,N);break;case 1:if(An(E,N,a),u=N,E=u.stateNode,typeof E.componentDidMount=="function")try{E.componentDidMount()}catch(fe){Ht(u,u.return,fe)}if(u=N,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++)v_(ne[E],K)}catch(fe){Ht(u,u.return,fe)}}a&&D&64&&j0(N),Jo(N,N.return);break;case 27:N0(N);case 26:case 5:An(E,N,a),a&&u===null&&D&4&&R0(N),Jo(N,N.return);break;case 12:An(E,N,a);break;case 31:An(E,N,a),a&&D&4&&L0(E,N);break;case 13:An(E,N,a),a&&D&4&&I0(E,N);break;case 22:N.memoizedState===null&&An(E,N,a),Jo(N,N.return);break;case 30:break;default:An(E,N,a)}i=i.sibling}}function Yf(s,i){var a=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),s=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(s=i.memoizedState.cachePool.pool),s!==a&&(s!=null&&s.refCount++,a!=null&&Io(a))}function Xf(s,i){s=null,i.alternate!==null&&(s=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==s&&(i.refCount++,s!=null&&Io(s))}function Yi(s,i,a,u){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)H0(s,i,a,u),i=i.sibling}function H0(s,i,a,u){var E=i.flags;switch(i.tag){case 0:case 11:case 15:Yi(s,i,a,u),E&2048&&Xo(9,i);break;case 1:Yi(s,i,a,u);break;case 3:Yi(s,i,a,u),E&2048&&(s=null,i.alternate!==null&&(s=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==s&&(i.refCount++,s!=null&&Io(s)));break;case 12:if(E&2048){Yi(s,i,a,u),s=i.stateNode;try{var N=i.memoizedProps,D=N.id,K=N.onPostCommit;typeof K=="function"&&K(D,i.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(ne){Ht(i,i.return,ne)}}else Yi(s,i,a,u);break;case 31:Yi(s,i,a,u);break;case 13:Yi(s,i,a,u);break;case 23:break;case 22:N=i.stateNode,D=i.alternate,i.memoizedState!==null?N._visibility&2?Yi(s,i,a,u):Zo(s,i):N._visibility&2?Yi(s,i,a,u):(N._visibility|=2,Na(s,i,a,u,(i.subtreeFlags&10256)!==0||!1)),E&2048&&Yf(D,i);break;case 24:Yi(s,i,a,u),E&2048&&Xf(i.alternate,i);break;default:Yi(s,i,a,u)}}function Na(s,i,a,u,E){for(E=E&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var N=s,D=i,K=a,ne=u,fe=D.flags;switch(D.tag){case 0:case 11:case 15:Na(N,D,K,ne,E),Xo(8,D);break;case 23:break;case 22:var xe=D.stateNode;D.memoizedState!==null?xe._visibility&2?Na(N,D,K,ne,E):Zo(N,D):(xe._visibility|=2,Na(N,D,K,ne,E)),E&&fe&2048&&Yf(D.alternate,D);break;case 24:Na(N,D,K,ne,E),E&&fe&2048&&Xf(D.alternate,D);break;default:Na(N,D,K,ne,E)}i=i.sibling}}function Zo(s,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var a=s,u=i,E=u.flags;switch(u.tag){case 22:Zo(a,u),E&2048&&Yf(u.alternate,u);break;case 24:Zo(a,u),E&2048&&Xf(u.alternate,u);break;default:Zo(a,u)}i=i.sibling}}var Qo=8192;function Ma(s,i,a){if(s.subtreeFlags&Qo)for(s=s.child;s!==null;)z0(s,i,a),s=s.sibling}function z0(s,i,a){switch(s.tag){case 26:Ma(s,i,a),s.flags&Qo&&s.memoizedState!==null&&jk(a,Ki,s.memoizedState,s.memoizedProps);break;case 5:Ma(s,i,a);break;case 3:case 4:var u=Ki;Ki=iu(s.stateNode.containerInfo),Ma(s,i,a),Ki=u;break;case 22:s.memoizedState===null&&(u=s.alternate,u!==null&&u.memoizedState!==null?(u=Qo,Qo=16777216,Ma(s,i,a),Qo=u):Ma(s,i,a));break;default:Ma(s,i,a)}}function U0(s){var i=s.alternate;if(i!==null&&(s=i.child,s!==null)){i.child=null;do i=s.sibling,s.sibling=null,s=i;while(s!==null)}}function el(s){var i=s.deletions;if((s.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var u=i[a];Ls=u,F0(u,s)}U0(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)q0(s),s=s.sibling}function q0(s){switch(s.tag){case 0:case 11:case 15:el(s),s.flags&2048&&nr(9,s,s.return);break;case 3:el(s);break;case 12:el(s);break;case 22:var i=s.stateNode;s.memoizedState!==null&&i._visibility&2&&(s.return===null||s.return.tag!==13)?(i._visibility&=-3,Fc(s)):el(s);break;default:el(s)}}function Fc(s){var i=s.deletions;if((s.flags&16)!==0){if(i!==null)for(var a=0;a<i.length;a++){var u=i[a];Ls=u,F0(u,s)}U0(s)}for(s=s.child;s!==null;){switch(i=s,i.tag){case 0:case 11:case 15:nr(8,i,i.return),Fc(i);break;case 22:a=i.stateNode,a._visibility&2&&(a._visibility&=-3,Fc(i));break;default:Fc(i)}s=s.sibling}}function F0(s,i){for(;Ls!==null;){var a=Ls;switch(a.tag){case 0:case 11:case 15:nr(8,a,i);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:Io(a.memoizedState.cache)}if(u=a.child,u!==null)u.return=a,Ls=u;else e:for(a=s;Ls!==null;){u=Ls;var E=u.sibling,N=u.return;if(D0(u),u===a){Ls=null;break e}if(E!==null){E.return=N,Ls=E;break e}Ls=N}}}var UE={getCacheForType:function(s){var i=Bs(Es),a=i.data.get(s);return a===void 0&&(a=s(),i.data.set(s,a)),a},cacheSignal:function(){return Bs(Es).controller.signal}},qE=typeof WeakMap=="function"?WeakMap:Map,Lt=0,Zt=null,bt=null,Ct=0,Bt=0,xi=null,rr=!1,Oa=!1,Jf=!1,Rn=0,vs=0,ar=0,Ur=0,Zf=0,Ci=0,Da=0,tl=null,hi=null,Qf=!1,Vc=0,V0=0,Wc=1/0,Gc=null,or=null,Ms=0,lr=null,$a=null,Tn=0,ep=0,tp=null,W0=null,sl=0,sp=null;function Ei(){return(Lt&2)!==0&&Ct!==0?Ct&-Ct:W.T!==null?lp():Mi()}function G0(){if(Ci===0)if((Ct&536870912)===0||kt){var s=Zs;Zs<<=1,(Zs&3932160)===0&&(Zs=262144),Ci=s}else Ci=536870912;return s=Si.current,s!==null&&(s.flags|=32),Ci}function fi(s,i,a){(s===Zt&&(Bt===2||Bt===9)||s.cancelPendingCommit!==null)&&(La(s,0),cr(s,Ct,Ci,!1)),ke(s,a),((Lt&2)===0||s!==Zt)&&(s===Zt&&((Lt&2)===0&&(Ur|=a),vs===4&&cr(s,Ct,Ci,!1)),ln(s))}function K0(s,i,a){if((Lt&6)!==0)throw Error(r(327));var u=!a&&(i&127)===0&&(i&s.expiredLanes)===0||Is(s,i),E=u?WE(s,i):np(s,i,!0),N=u;do{if(E===0){Oa&&!u&&cr(s,i,0,!1);break}else{if(a=s.current.alternate,N&&!FE(a)){E=np(s,i,!1),N=!1;continue}if(E===2){if(N=i,s.errorRecoveryDisabledLanes&N)var D=0;else D=s.pendingLanes&-536870913,D=D!==0?D:D&536870912?536870912:0;if(D!==0){i=D;e:{var K=s;E=tl;var ne=K.current.memoizedState.isDehydrated;if(ne&&(La(K,D).flags|=256),D=np(K,D,!1),D!==2){if(Jf&&!ne){K.errorRecoveryDisabledLanes|=N,Ur|=N,E=4;break e}N=hi,hi=E,N!==null&&(hi===null?hi=N:hi.push.apply(hi,N))}E=D}if(N=!1,E!==2)continue}}if(E===1){La(s,0),cr(s,i,0,!0);break}e:{switch(u=s,N=E,N){case 0:case 1:throw Error(r(345));case 4:if((i&4194048)!==i)break;case 6:cr(u,i,Ci,!rr);break e;case 2:hi=null;break;case 3:case 5:break;default:throw Error(r(329))}if((i&62914560)===i&&(E=Vc+300-Ke(),10<E)){if(cr(u,i,Ci,!rr),ai(u,0,!0)!==0)break e;Tn=i,u.timeoutHandle=Ey(Y0.bind(null,u,a,hi,Gc,Qf,i,Ci,Ur,Da,rr,N,"Throttled",-0,0),E);break e}Y0(u,a,hi,Gc,Qf,i,Ci,Ur,Da,rr,N,null,-0,0)}}break}while(!0);ln(s)}function Y0(s,i,a,u,E,N,D,K,ne,fe,xe,Ee,pe,ye){if(s.timeoutHandle=-1,Ee=i.subtreeFlags,Ee&8192||(Ee&16785408)===16785408){Ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Di},z0(i,N,Ee);var Be=(N&62914560)===N?Vc-Ke():(N&4194048)===N?V0-Ke():0;if(Be=Ak(Ee,Be),Be!==null){Tn=N,s.cancelPendingCommit=Be(iy.bind(null,s,i,N,a,u,E,D,K,ne,xe,Ee,null,pe,ye)),cr(s,N,D,!fe);return}}iy(s,i,N,a,u,E,D,K,ne)}function FE(s){for(var i=s;;){var a=i.tag;if((a===0||a===11||a===15)&&i.flags&16384&&(a=i.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var u=0;u<a.length;u++){var E=a[u],N=E.getSnapshot;E=E.value;try{if(!yi(N(),E))return!1}catch{return!1}}if(a=i.child,i.subtreeFlags&16384&&a!==null)a.return=i,i=a;else{if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function cr(s,i,a,u){i&=~Zf,i&=~Ur,s.suspendedLanes|=i,s.pingedLanes&=~i,u&&(s.warmLanes|=i),u=s.expirationTimes;for(var E=i;0<E;){var N=31-ts(E),D=1<<N;u[N]=-1,E&=~D}a!==0&&Vt(s,a,i)}function Kc(){return(Lt&6)===0?(il(0),!1):!0}function ip(){if(bt!==null){if(Bt===0)var s=bt.return;else s=bt,yn=Or=null,yf(s),ka=null,Bo=0,s=bt;for(;s!==null;)k0(s.alternate,s),s=s.return;bt=null}}function La(s,i){var a=s.timeoutHandle;a!==-1&&(s.timeoutHandle=-1,uk(a)),a=s.cancelPendingCommit,a!==null&&(s.cancelPendingCommit=null,a()),Tn=0,ip(),Zt=s,bt=a=gn(s.current,null),Ct=i,Bt=0,xi=null,rr=!1,Oa=Is(s,i),Jf=!1,Da=Ci=Zf=Ur=ar=vs=0,hi=tl=null,Qf=!1,(i&8)!==0&&(i|=i&32);var u=s.entangledLanes;if(u!==0)for(s=s.entanglements,u&=i;0<u;){var E=31-ts(u),N=1<<E;i|=s[E],u&=~N}return Rn=i,mc(),a}function X0(s,i){dt=null,W.H=Go,i===Ea||i===xc?(i=h_(),Bt=3):i===of?(i=h_(),Bt=4):Bt=i===$f?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,xi=i,bt===null&&(vs=1,Ic(s,Li(i,s.current)))}function J0(){var s=Si.current;return s===null?!0:(Ct&4194048)===Ct?Hi===null:(Ct&62914560)===Ct||(Ct&536870912)!==0?s===Hi:!1}function Z0(){var s=W.H;return W.H=Go,s===null?Go:s}function Q0(){var s=W.A;return W.A=UE,s}function Yc(){vs=4,rr||(Ct&4194048)!==Ct&&Si.current!==null||(Oa=!0),(ar&134217727)===0&&(Ur&134217727)===0||Zt===null||cr(Zt,Ct,Ci,!1)}function np(s,i,a){var u=Lt;Lt|=2;var E=Z0(),N=Q0();(Zt!==s||Ct!==i)&&(Gc=null,La(s,i)),i=!1;var D=vs;e:do try{if(Bt!==0&&bt!==null){var K=bt,ne=xi;switch(Bt){case 8:ip(),D=6;break e;case 3:case 2:case 9:case 6:Si.current===null&&(i=!0);var fe=Bt;if(Bt=0,xi=null,Ia(s,K,ne,fe),a&&Oa){D=0;break e}break;default:fe=Bt,Bt=0,xi=null,Ia(s,K,ne,fe)}}VE(),D=vs;break}catch(xe){X0(s,xe)}while(!0);return i&&s.shellSuspendCounter++,yn=Or=null,Lt=u,W.H=E,W.A=N,bt===null&&(Zt=null,Ct=0,mc()),D}function VE(){for(;bt!==null;)ey(bt)}function WE(s,i){var a=Lt;Lt|=2;var u=Z0(),E=Q0();Zt!==s||Ct!==i?(Gc=null,Wc=Ke()+500,La(s,i)):Oa=Is(s,i);e:do try{if(Bt!==0&&bt!==null){i=bt;var N=xi;t:switch(Bt){case 1:Bt=0,xi=null,Ia(s,i,N,1);break;case 2:case 9:if(u_(N)){Bt=0,xi=null,ty(i);break}i=function(){Bt!==2&&Bt!==9||Zt!==s||(Bt=7),ln(s)},N.then(i,i);break e;case 3:Bt=7;break e;case 4:Bt=5;break e;case 7:u_(N)?(Bt=0,xi=null,ty(i)):(Bt=0,xi=null,Ia(s,i,N,7));break;case 5:var D=null;switch(bt.tag){case 26:D=bt.memoizedState;case 5:case 27:var K=bt;if(D?Hy(D):K.stateNode.complete){Bt=0,xi=null;var ne=K.sibling;if(ne!==null)bt=ne;else{var fe=K.return;fe!==null?(bt=fe,Xc(fe)):bt=null}break t}}Bt=0,xi=null,Ia(s,i,N,5);break;case 6:Bt=0,xi=null,Ia(s,i,N,6);break;case 8:ip(),vs=6;break e;default:throw Error(r(462))}}GE();break}catch(xe){X0(s,xe)}while(!0);return yn=Or=null,W.H=u,W.A=E,Lt=a,bt!==null?0:(Zt=null,Ct=0,mc(),vs)}function GE(){for(;bt!==null&&!vt();)ey(bt)}function ey(s){var i=C0(s.alternate,s,Rn);s.memoizedProps=s.pendingProps,i===null?Xc(s):bt=i}function ty(s){var i=s,a=i.alternate;switch(i.tag){case 15:case 0:i=_0(a,i,i.pendingProps,i.type,void 0,Ct);break;case 11:i=_0(a,i,i.pendingProps,i.type.render,i.ref,Ct);break;case 5:yf(i);default:k0(a,i),i=bt=Qg(i,Rn),i=C0(a,i,Rn)}s.memoizedProps=s.pendingProps,i===null?Xc(s):bt=i}function Ia(s,i,a,u){yn=Or=null,yf(i),ka=null,Bo=0;var E=i.return;try{if($E(s,E,i,a,Ct)){vs=1,Ic(s,Li(a,s.current)),bt=null;return}}catch(N){if(E!==null)throw bt=E,N;vs=1,Ic(s,Li(a,s.current)),bt=null;return}i.flags&32768?(kt||u===1?s=!0:Oa||(Ct&536870912)!==0?s=!1:(rr=s=!0,(u===2||u===9||u===3||u===6)&&(u=Si.current,u!==null&&u.tag===13&&(u.flags|=16384))),sy(i,s)):Xc(i)}function Xc(s){var i=s;do{if((i.flags&32768)!==0){sy(i,rr);return}s=i.return;var a=PE(i.alternate,i,Rn);if(a!==null){bt=a;return}if(i=i.sibling,i!==null){bt=i;return}bt=i=s}while(i!==null);vs===0&&(vs=5)}function sy(s,i){do{var a=BE(s.alternate,s);if(a!==null){a.flags&=32767,bt=a;return}if(a=s.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(s=s.sibling,s!==null)){bt=s;return}bt=s=a}while(s!==null);vs=6,bt=null}function iy(s,i,a,u,E,N,D,K,ne){s.cancelPendingCommit=null;do Jc();while(Ms!==0);if((Lt&6)!==0)throw Error(r(327));if(i!==null){if(i===s.current)throw Error(r(177));if(N=i.lanes|i.childLanes,N|=Vh,Xe(s,a,N,D,K,ne),s===Zt&&(bt=Zt=null,Ct=0),$a=i,lr=s,Tn=a,ep=N,tp=E,W0=u,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,JE(Dt,function(){return ly(),null})):(s.callbackNode=null,s.callbackPriority=0),u=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||u){u=W.T,W.T=null,E=se.p,se.p=2,D=Lt,Lt|=4;try{HE(s,i,a)}finally{Lt=D,se.p=E,W.T=u}}Ms=1,ny(),ry(),ay()}}function ny(){if(Ms===1){Ms=0;var s=lr,i=$a,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=W.T,W.T=null;var u=se.p;se.p=2;var E=Lt;Lt|=4;try{P0(i,s);var N=vp,D=Fg(s.containerInfo),K=N.focusedElem,ne=N.selectionRange;if(D!==K&&K&&K.ownerDocument&&qg(K.ownerDocument.documentElement,K)){if(ne!==null&&Hh(K)){var fe=ne.start,xe=ne.end;if(xe===void 0&&(xe=fe),"selectionStart"in K)K.selectionStart=fe,K.selectionEnd=Math.min(xe,K.value.length);else{var Ee=K.ownerDocument||document,pe=Ee&&Ee.defaultView||window;if(pe.getSelection){var ye=pe.getSelection(),Be=K.textContent.length,We=Math.min(ne.start,Be),Kt=ne.end===void 0?We:Math.min(ne.end,Be);!ye.extend&&We>Kt&&(D=Kt,Kt=We,We=D);var le=Ug(K,We),re=Ug(K,Kt);if(le&&re&&(ye.rangeCount!==1||ye.anchorNode!==le.node||ye.anchorOffset!==le.offset||ye.focusNode!==re.node||ye.focusOffset!==re.offset)){var he=Ee.createRange();he.setStart(le.node,le.offset),ye.removeAllRanges(),We>Kt?(ye.addRange(he),ye.extend(re.node,re.offset)):(he.setEnd(re.node,re.offset),ye.addRange(he))}}}}for(Ee=[],ye=K;ye=ye.parentNode;)ye.nodeType===1&&Ee.push({element:ye,left:ye.scrollLeft,top:ye.scrollTop});for(typeof K.focus=="function"&&K.focus(),K=0;K<Ee.length;K++){var Ce=Ee[K];Ce.element.scrollLeft=Ce.left,Ce.element.scrollTop=Ce.top}}cu=!!mp,vp=mp=null}finally{Lt=E,se.p=u,W.T=a}}s.current=i,Ms=2}}function ry(){if(Ms===2){Ms=0;var s=lr,i=$a,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=W.T,W.T=null;var u=se.p;se.p=2;var E=Lt;Lt|=4;try{O0(s,i.alternate,i)}finally{Lt=E,se.p=u,W.T=a}}Ms=3}}function ay(){if(Ms===4||Ms===3){Ms=0,tt();var s=lr,i=$a,a=Tn,u=W0;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Ms=5:(Ms=0,$a=lr=null,oy(s,s.pendingLanes));var E=s.pendingLanes;if(E===0&&(or=null),_i(a),i=i.stateNode,Fe&&typeof Fe.onCommitFiberRoot=="function")try{Fe.onCommitFiberRoot(_s,i,void 0,(i.current.flags&128)===128)}catch{}if(u!==null){i=W.T,E=se.p,se.p=2,W.T=null;try{for(var N=s.onRecoverableError,D=0;D<u.length;D++){var K=u[D];N(K.value,{componentStack:K.stack})}}finally{W.T=i,se.p=E}}(Tn&3)!==0&&Jc(),ln(s),E=s.pendingLanes,(a&261930)!==0&&(E&42)!==0?s===sp?sl++:(sl=0,sp=s):sl=0,il(0)}}function oy(s,i){(s.pooledCacheLanes&=i)===0&&(i=s.pooledCache,i!=null&&(s.pooledCache=null,Io(i)))}function Jc(){return ny(),ry(),ay(),ly()}function ly(){if(Ms!==5)return!1;var s=lr,i=ep;ep=0;var a=_i(Tn),u=W.T,E=se.p;try{se.p=32>a?32:a,W.T=null,a=tp,tp=null;var N=lr,D=Tn;if(Ms=0,$a=lr=null,Tn=0,(Lt&6)!==0)throw Error(r(331));var K=Lt;if(Lt|=4,q0(N.current),H0(N,N.current,D,a),Lt=K,il(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot=="function")try{Fe.onPostCommitFiberRoot(_s,N)}catch{}return!0}finally{se.p=E,W.T=u,oy(s,i)}}function cy(s,i,a){i=Li(a,i),i=Df(s.stateNode,i,2),s=tr(s,i,2),s!==null&&(ke(s,2),ln(s))}function Ht(s,i,a){if(s.tag===3)cy(s,s,a);else for(;i!==null;){if(i.tag===3){cy(i,s,a);break}else if(i.tag===1){var u=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(or===null||!or.has(u))){s=Li(a,s),a=u0(2),u=tr(i,a,2),u!==null&&(d0(a,u,i,s),ke(u,2),ln(u));break}}i=i.return}}function rp(s,i,a){var u=s.pingCache;if(u===null){u=s.pingCache=new qE;var E=new Set;u.set(i,E)}else E=u.get(i),E===void 0&&(E=new Set,u.set(i,E));E.has(a)||(Jf=!0,E.add(a),s=KE.bind(null,s,i,a),i.then(s,s))}function KE(s,i,a){var u=s.pingCache;u!==null&&u.delete(i),s.pingedLanes|=s.suspendedLanes&a,s.warmLanes&=~a,Zt===s&&(Ct&a)===a&&(vs===4||vs===3&&(Ct&62914560)===Ct&&300>Ke()-Vc?(Lt&2)===0&&La(s,0):Zf|=a,Da===Ct&&(Da=0)),ln(s)}function uy(s,i){i===0&&(i=st()),s=Tr(s,i),s!==null&&(ke(s,i),ln(s))}function YE(s){var i=s.memoizedState,a=0;i!==null&&(a=i.retryLane),uy(s,a)}function XE(s,i){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(i),uy(s,a)}function JE(s,i){return mt(s,i)}var Zc=null,Pa=null,ap=!1,Qc=!1,op=!1,ur=0;function ln(s){s!==Pa&&s.next===null&&(Pa===null?Zc=Pa=s:Pa=Pa.next=s),Qc=!0,ap||(ap=!0,QE())}function il(s,i){if(!op&&Qc){op=!0;do for(var a=!1,u=Zc;u!==null;){if(s!==0){var E=u.pendingLanes;if(E===0)var N=0;else{var D=u.suspendedLanes,K=u.pingedLanes;N=(1<<31-ts(42|s)+1)-1,N&=E&~(D&~K),N=N&201326741?N&201326741|1:N?N|2:0}N!==0&&(a=!0,py(u,N))}else N=Ct,N=ai(u,u===Zt?N:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(N&3)===0||Is(u,N)||(a=!0,py(u,N));u=u.next}while(a);op=!1}}function ZE(){dy()}function dy(){Qc=ap=!1;var s=0;ur!==0&&ck()&&(s=ur);for(var i=Ke(),a=null,u=Zc;u!==null;){var E=u.next,N=hy(u,i);N===0?(u.next=null,a===null?Zc=E:a.next=E,E===null&&(Pa=a)):(a=u,(s!==0||(N&3)!==0)&&(Qc=!0)),u=E}Ms!==0&&Ms!==5||il(s),ur!==0&&(ur=0)}function hy(s,i){for(var a=s.suspendedLanes,u=s.pingedLanes,E=s.expirationTimes,N=s.pendingLanes&-62914561;0<N;){var D=31-ts(N),K=1<<D,ne=E[D];ne===-1?((K&a)===0||(K&u)!==0)&&(E[D]=$s(K,i)):ne<=i&&(s.expiredLanes|=K),N&=~K}if(i=Zt,a=Ct,a=ai(s,s===i?a:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),u=s.callbackNode,a===0||s===i&&(Bt===2||Bt===9)||s.cancelPendingCommit!==null)return u!==null&&u!==null&&et(u),s.callbackNode=null,s.callbackPriority=0;if((a&3)===0||Is(s,a)){if(i=a&-a,i===s.callbackPriority)return i;switch(u!==null&&et(u),_i(a)){case 2:case 8:a=fs;break;case 32:a=Dt;break;case 268435456:a=gs;break;default:a=Dt}return u=fy.bind(null,s),a=mt(a,u),s.callbackPriority=i,s.callbackNode=a,i}return u!==null&&u!==null&&et(u),s.callbackPriority=2,s.callbackNode=null,2}function fy(s,i){if(Ms!==0&&Ms!==5)return s.callbackNode=null,s.callbackPriority=0,null;var a=s.callbackNode;if(Jc()&&s.callbackNode!==a)return null;var u=Ct;return u=ai(s,s===Zt?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),u===0?null:(K0(s,u,i),hy(s,Ke()),s.callbackNode!=null&&s.callbackNode===a?fy.bind(null,s):null)}function py(s,i){if(Jc())return null;K0(s,i,!0)}function QE(){dk(function(){(Lt&6)!==0?mt(jt,ZE):dy()})}function lp(){if(ur===0){var s=xa;s===0&&(s=ri,ri<<=1,(ri&261888)===0&&(ri=256)),ur=s}return ur}function my(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:kr(""+s)}function vy(s,i){var a=i.ownerDocument.createElement("input");return a.name=i.name,a.value=i.value,s.id&&a.setAttribute("form",s.id),i.parentNode.insertBefore(a,i),s=new FormData(s),a.parentNode.removeChild(a),s}function ek(s,i,a,u,E){if(i==="submit"&&a&&a.stateNode===E){var N=my((E[Se]||null).action),D=u.submitter;D&&(i=(i=D[Se]||null)?my(i.formAction):D.getAttribute("formAction"),i!==null&&(N=i,D=null));var K=new dc("action","action",null,u,E);s.push({event:K,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(ur!==0){var ne=D?vy(E,D):new FormData(E);Af(a,{pending:!0,data:ne,method:E.method,action:N},null,ne)}}else typeof N=="function"&&(K.preventDefault(),ne=D?vy(E,D):new FormData(E),Af(a,{pending:!0,data:ne,method:E.method,action:N},N,ne))},currentTarget:E}]})}}for(var cp=0;cp<Fh.length;cp++){var up=Fh[cp],tk=up.toLowerCase(),sk=up[0].toUpperCase()+up.slice(1);Gi(tk,"on"+sk)}Gi(Gg,"onAnimationEnd"),Gi(Kg,"onAnimationIteration"),Gi(Yg,"onAnimationStart"),Gi("dblclick","onDoubleClick"),Gi("focusin","onFocus"),Gi("focusout","onBlur"),Gi(_E,"onTransitionRun"),Gi(yE,"onTransitionStart"),Gi(bE,"onTransitionCancel"),Gi(Xg,"onTransitionEnd"),lt("onMouseEnter",["mouseout","mouseover"]),lt("onMouseLeave",["mouseout","mouseover"]),lt("onPointerEnter",["pointerout","pointerover"]),lt("onPointerLeave",["pointerout","pointerover"]),He("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),He("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),He("onBeforeInput",["compositionend","keypress","textInput","paste"]),He("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),He("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),He("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var nl="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(" "),ik=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(nl));function gy(s,i){i=(i&4)!==0;for(var a=0;a<s.length;a++){var u=s[a],E=u.event;u=u.listeners;e:{var N=void 0;if(i)for(var D=u.length-1;0<=D;D--){var K=u[D],ne=K.instance,fe=K.currentTarget;if(K=K.listener,ne!==N&&E.isPropagationStopped())break e;N=K,E.currentTarget=fe;try{N(E)}catch(xe){pc(xe)}E.currentTarget=null,N=ne}else for(D=0;D<u.length;D++){if(K=u[D],ne=K.instance,fe=K.currentTarget,K=K.listener,ne!==N&&E.isPropagationStopped())break e;N=K,E.currentTarget=fe;try{N(E)}catch(xe){pc(xe)}E.currentTarget=null,N=ne}}}}function St(s,i){var a=i[Je];a===void 0&&(a=i[Je]=new Set);var u=s+"__bubble";a.has(u)||(_y(i,s,2,!1),a.add(u))}function dp(s,i,a){var u=0;i&&(u|=4),_y(a,s,u,i)}var eu="_reactListening"+Math.random().toString(36).slice(2);function hp(s){if(!s[eu]){s[eu]=!0,bs.forEach(function(a){a!=="selectionchange"&&(ik.has(a)||dp(a,!1,s),dp(a,!0,s))});var i=s.nodeType===9?s:s.ownerDocument;i===null||i[eu]||(i[eu]=!0,dp("selectionchange",!1,i))}}function _y(s,i,a,u){switch(Gy(i)){case 2:var E=Nk;break;case 8:E=Mk;break;default:E=jp}a=E.bind(null,i,a,s),E=void 0,!Ss||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(E=!0),u?E!==void 0?s.addEventListener(i,a,{capture:!0,passive:E}):s.addEventListener(i,a,!0):E!==void 0?s.addEventListener(i,a,{passive:E}):s.addEventListener(i,a,!1)}function fp(s,i,a,u,E){var N=u;if((i&1)===0&&(i&2)===0&&u!==null)e:for(;;){if(u===null)return;var D=u.tag;if(D===3||D===4){var K=u.stateNode.containerInfo;if(K===E)break;if(D===4)for(D=u.return;D!==null;){var ne=D.tag;if((ne===3||ne===4)&&D.stateNode.containerInfo===E)return;D=D.return}for(;K!==null;){if(D=_e(K),D===null)return;if(ne=D.tag,ne===5||ne===6||ne===26||ne===27){u=N=D;continue e}K=K.parentNode}}u=u.return}Qe(function(){var fe=N,xe=fa(a),Ee=[];e:{var pe=Jg.get(s);if(pe!==void 0){var ye=dc,Be=s;switch(s){case"keypress":if(cc(a)===0)break e;case"keydown":case"keyup":ye=X2;break;case"focusin":Be="focus",ye=$h;break;case"focusout":Be="blur",ye=$h;break;case"beforeblur":case"afterblur":ye=$h;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":ye=kg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ye=P2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ye=Q2;break;case Gg:case Kg:case Yg:ye=z2;break;case Xg:ye=tE;break;case"scroll":case"scrollend":ye=L2;break;case"wheel":ye=iE;break;case"copy":case"cut":case"paste":ye=q2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ye=Ag;break;case"toggle":case"beforetoggle":ye=rE}var We=(i&4)!==0,Kt=!We&&(s==="scroll"||s==="scrollend"),le=We?pe!==null?pe+"Capture":null:pe;We=[];for(var re=fe,he;re!==null;){var Ce=re;if(he=Ce.stateNode,Ce=Ce.tag,Ce!==5&&Ce!==26&&Ce!==27||he===null||le===null||(Ce=$t(re,le),Ce!=null&&We.push(rl(re,Ce,he))),Kt)break;re=re.return}0<We.length&&(pe=new ye(pe,Be,null,a,xe),Ee.push({event:pe,listeners:We}))}}if((i&7)===0){e:{if(pe=s==="mouseover"||s==="pointerover",ye=s==="mouseout"||s==="pointerout",pe&&a!==ha&&(Be=a.relatedTarget||a.fromElement)&&(_e(Be)||Be[Me]))break e;if((ye||pe)&&(pe=xe.window===xe?xe:(pe=xe.ownerDocument)?pe.defaultView||pe.parentWindow:window,ye?(Be=a.relatedTarget||a.toElement,ye=fe,Be=Be?_e(Be):null,Be!==null&&(Kt=c(Be),We=Be.tag,Be!==Kt||We!==5&&We!==27&&We!==6)&&(Be=null)):(ye=null,Be=fe),ye!==Be)){if(We=kg,Ce="onMouseLeave",le="onMouseEnter",re="mouse",(s==="pointerout"||s==="pointerover")&&(We=Ag,Ce="onPointerLeave",le="onPointerEnter",re="pointer"),Kt=ye==null?pe:Oe(ye),he=Be==null?pe:Oe(Be),pe=new We(Ce,re+"leave",ye,a,xe),pe.target=Kt,pe.relatedTarget=he,Ce=null,_e(xe)===fe&&(We=new We(le,re+"enter",Be,a,xe),We.target=he,We.relatedTarget=Kt,Ce=We),Kt=Ce,ye&&Be)t:{for(We=nk,le=ye,re=Be,he=0,Ce=le;Ce;Ce=We(Ce))he++;Ce=0;for(var qe=re;qe;qe=We(qe))Ce++;for(;0<he-Ce;)le=We(le),he--;for(;0<Ce-he;)re=We(re),Ce--;for(;he--;){if(le===re||re!==null&&le===re.alternate){We=le;break t}le=We(le),re=We(re)}We=null}else We=null;ye!==null&&yy(Ee,pe,ye,We,!1),Be!==null&&Kt!==null&&yy(Ee,Kt,Be,We,!0)}}e:{if(pe=fe?Oe(fe):window,ye=pe.nodeName&&pe.nodeName.toLowerCase(),ye==="select"||ye==="input"&&pe.type==="file")var Nt=Lg;else if(Dg(pe))if(Ig)Nt=mE;else{Nt=fE;var ze=hE}else ye=pe.nodeName,!ye||ye.toLowerCase()!=="input"||pe.type!=="checkbox"&&pe.type!=="radio"?fe&&da(fe.elementType)&&(Nt=Lg):Nt=pE;if(Nt&&(Nt=Nt(s,fe))){$g(Ee,Nt,a,xe);break e}ze&&ze(s,pe,fe),s==="focusout"&&fe&&pe.type==="number"&&fe.memoizedProps.value!=null&&ua(pe,"number",pe.value)}switch(ze=fe?Oe(fe):window,s){case"focusin":(Dg(ze)||ze.contentEditable==="true")&&(ma=ze,zh=fe,Do=null);break;case"focusout":Do=zh=ma=null;break;case"mousedown":Uh=!0;break;case"contextmenu":case"mouseup":case"dragend":Uh=!1,Vg(Ee,a,xe);break;case"selectionchange":if(gE)break;case"keydown":case"keyup":Vg(Ee,a,xe)}var ht;if(Ih)e:{switch(s){case"compositionstart":var Et="onCompositionStart";break e;case"compositionend":Et="onCompositionEnd";break e;case"compositionupdate":Et="onCompositionUpdate";break e}Et=void 0}else pa?Mg(s,a)&&(Et="onCompositionEnd"):s==="keydown"&&a.keyCode===229&&(Et="onCompositionStart");Et&&(Rg&&a.locale!=="ko"&&(pa||Et!=="onCompositionStart"?Et==="onCompositionEnd"&&pa&&(ht=Cg()):(Kn=xe,Mh="value"in Kn?Kn.value:Kn.textContent,pa=!0)),ze=tu(fe,Et),0<ze.length&&(Et=new jg(Et,s,null,a,xe),Ee.push({event:Et,listeners:ze}),ht?Et.data=ht:(ht=Og(a),ht!==null&&(Et.data=ht)))),(ht=oE?lE(s,a):cE(s,a))&&(Et=tu(fe,"onBeforeInput"),0<Et.length&&(ze=new jg("onBeforeInput","beforeinput",null,a,xe),Ee.push({event:ze,listeners:Et}),ze.data=ht)),ek(Ee,s,fe,a,xe)}gy(Ee,i)})}function rl(s,i,a){return{instance:s,listener:i,currentTarget:a}}function tu(s,i){for(var a=i+"Capture",u=[];s!==null;){var E=s,N=E.stateNode;if(E=E.tag,E!==5&&E!==26&&E!==27||N===null||(E=$t(s,a),E!=null&&u.unshift(rl(s,E,N)),E=$t(s,i),E!=null&&u.push(rl(s,E,N))),s.tag===3)return u;s=s.return}return[]}function nk(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function yy(s,i,a,u,E){for(var N=i._reactName,D=[];a!==null&&a!==u;){var K=a,ne=K.alternate,fe=K.stateNode;if(K=K.tag,ne!==null&&ne===u)break;K!==5&&K!==26&&K!==27||fe===null||(ne=fe,E?(fe=$t(a,N),fe!=null&&D.unshift(rl(a,fe,ne))):E||(fe=$t(a,N),fe!=null&&D.push(rl(a,fe,ne)))),a=a.return}D.length!==0&&s.push({event:i,listeners:D})}var rk=/\r\n?/g,ak=/\u0000|\uFFFD/g;function by(s){return(typeof s=="string"?s:""+s).replace(rk,`
|
|
49
|
-
`).replace(ak,"")}function Sy(s,i){return i=by(i),by(s)===i}function Gt(s,i,a,u,E,N){switch(a){case"children":typeof u=="string"?i==="body"||i==="textarea"&&u===""||mn(s,u):(typeof u=="number"||typeof u=="bigint")&&i!=="body"&&mn(s,""+u);break;case"className":la(s,"class",u);break;case"tabIndex":la(s,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":la(s,a,u);break;case"style":jo(s,u,N);break;case"data":if(i!=="object"){la(s,"data",u);break}case"src":case"href":if(u===""&&(i!=="a"||a!=="href")){s.removeAttribute(a);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){s.removeAttribute(a);break}u=kr(""+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 N=="function"&&(a==="formAction"?(i!=="input"&&Gt(s,i,"name",E.name,E,null),Gt(s,i,"formEncType",E.formEncType,E,null),Gt(s,i,"formMethod",E.formMethod,E,null),Gt(s,i,"formTarget",E.formTarget,E,null)):(Gt(s,i,"encType",E.encType,E,null),Gt(s,i,"method",E.method,E,null),Gt(s,i,"target",E.target,E,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){s.removeAttribute(a);break}u=kr(""+u),s.setAttribute(a,u);break;case"onClick":u!=null&&(s.onclick=Di);break;case"onScroll":u!=null&&St("scroll",s);break;case"onScrollEnd":u!=null&&St("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=kr(""+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":St("beforetoggle",s),St("toggle",s),nn(s,"popover",u);break;case"xlinkActuate":Oi(s,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Oi(s,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Oi(s,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Oi(s,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Oi(s,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Oi(s,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Oi(s,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Oi(s,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Oi(s,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":nn(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=ac.get(a)||a,nn(s,a,u))}}function pp(s,i,a,u,E,N){switch(a){case"style":jo(s,u,N);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"?mn(s,u):(typeof u=="number"||typeof u=="bigint")&&mn(s,""+u);break;case"onScroll":u!=null&&St("scroll",s);break;case"onScrollEnd":u!=null&&St("scrollend",s);break;case"onClick":u!=null&&(s.onclick=Di);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ve.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(E=a.endsWith("Capture"),i=a.slice(2,E?a.length-7:void 0),N=s[Se]||null,N=N!=null?N[a]:null,typeof N=="function"&&s.removeEventListener(i,N,E),typeof u=="function")){typeof N!="function"&&N!==null&&(a in s?s[a]=null:s.hasAttribute(a)&&s.removeAttribute(a)),s.addEventListener(i,u,E);break e}a in s?s[a]=u:u===!0?s.setAttribute(a,""):nn(s,a,u)}}}function zs(s,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":St("error",s),St("load",s);var u=!1,E=!1,N;for(N in a)if(a.hasOwnProperty(N)){var D=a[N];if(D!=null)switch(N){case"src":u=!0;break;case"srcSet":E=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:Gt(s,i,N,D,a,null)}}E&&Gt(s,i,"srcSet",a.srcSet,a,null),u&&Gt(s,i,"src",a.src,a,null);return;case"input":St("invalid",s);var K=N=D=E=null,ne=null,fe=null;for(u in a)if(a.hasOwnProperty(u)){var xe=a[u];if(xe!=null)switch(u){case"name":E=xe;break;case"type":D=xe;break;case"checked":ne=xe;break;case"defaultChecked":fe=xe;break;case"value":N=xe;break;case"defaultValue":K=xe;break;case"children":case"dangerouslySetInnerHTML":if(xe!=null)throw Error(r(137,i));break;default:Gt(s,i,u,xe,a,null)}}xo(s,N,K,ne,fe,D,E,!1);return;case"select":St("invalid",s),u=D=N=null;for(E in a)if(a.hasOwnProperty(E)&&(K=a[E],K!=null))switch(E){case"value":N=K;break;case"defaultValue":D=K;break;case"multiple":u=K;default:Gt(s,i,E,K,a,null)}i=N,a=D,s.multiple=!!u,i!=null?pn(s,!!u,i,!1):a!=null&&pn(s,!!u,a,!0);return;case"textarea":St("invalid",s),N=E=u=null;for(D in a)if(a.hasOwnProperty(D)&&(K=a[D],K!=null))switch(D){case"value":u=K;break;case"defaultValue":E=K;break;case"children":N=K;break;case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(91));break;default:Gt(s,i,D,K,a,null)}Eo(s,u,E,N);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:Gt(s,i,ne,u,a,null)}return;case"dialog":St("beforetoggle",s),St("toggle",s),St("cancel",s),St("close",s);break;case"iframe":case"object":St("load",s);break;case"video":case"audio":for(u=0;u<nl.length;u++)St(nl[u],s);break;case"image":St("error",s),St("load",s);break;case"details":St("toggle",s);break;case"embed":case"source":case"link":St("error",s),St("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(fe in a)if(a.hasOwnProperty(fe)&&(u=a[fe],u!=null))switch(fe){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:Gt(s,i,fe,u,a,null)}return;default:if(da(i)){for(xe in a)a.hasOwnProperty(xe)&&(u=a[xe],u!==void 0&&pp(s,i,xe,u,a,void 0));return}}for(K in a)a.hasOwnProperty(K)&&(u=a[K],u!=null&&Gt(s,i,K,u,a,null))}function ok(s,i,a,u){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var E=null,N=null,D=null,K=null,ne=null,fe=null,xe=null;for(ye in a){var Ee=a[ye];if(a.hasOwnProperty(ye)&&Ee!=null)switch(ye){case"checked":break;case"value":break;case"defaultValue":ne=Ee;default:u.hasOwnProperty(ye)||Gt(s,i,ye,null,u,Ee)}}for(var pe in u){var ye=u[pe];if(Ee=a[pe],u.hasOwnProperty(pe)&&(ye!=null||Ee!=null))switch(pe){case"type":N=ye;break;case"name":E=ye;break;case"checked":fe=ye;break;case"defaultChecked":xe=ye;break;case"value":D=ye;break;case"defaultValue":K=ye;break;case"children":case"dangerouslySetInnerHTML":if(ye!=null)throw Error(r(137,i));break;default:ye!==Ee&&Gt(s,i,pe,ye,u,Ee)}}ca(s,D,K,ne,fe,xe,N,E);return;case"select":ye=D=K=pe=null;for(N in a)if(ne=a[N],a.hasOwnProperty(N)&&ne!=null)switch(N){case"value":break;case"multiple":ye=ne;default:u.hasOwnProperty(N)||Gt(s,i,N,null,u,ne)}for(E in u)if(N=u[E],ne=a[E],u.hasOwnProperty(E)&&(N!=null||ne!=null))switch(E){case"value":pe=N;break;case"defaultValue":K=N;break;case"multiple":D=N;default:N!==ne&&Gt(s,i,E,N,u,ne)}i=K,a=D,u=ye,pe!=null?pn(s,!!a,pe,!1):!!u!=!!a&&(i!=null?pn(s,!!a,i,!0):pn(s,!!a,a?[]:"",!1));return;case"textarea":ye=pe=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:Gt(s,i,K,null,u,E)}for(D in u)if(E=u[D],N=a[D],u.hasOwnProperty(D)&&(E!=null||N!=null))switch(D){case"value":pe=E;break;case"defaultValue":ye=E;break;case"children":break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(r(91));break;default:E!==N&&Gt(s,i,D,E,u,N)}Co(s,pe,ye);return;case"option":for(var Be in a)if(pe=a[Be],a.hasOwnProperty(Be)&&pe!=null&&!u.hasOwnProperty(Be))switch(Be){case"selected":s.selected=!1;break;default:Gt(s,i,Be,null,u,pe)}for(ne in u)if(pe=u[ne],ye=a[ne],u.hasOwnProperty(ne)&&pe!==ye&&(pe!=null||ye!=null))switch(ne){case"selected":s.selected=pe&&typeof pe!="function"&&typeof pe!="symbol";break;default:Gt(s,i,ne,pe,u,ye)}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 We in a)pe=a[We],a.hasOwnProperty(We)&&pe!=null&&!u.hasOwnProperty(We)&&Gt(s,i,We,null,u,pe);for(fe in u)if(pe=u[fe],ye=a[fe],u.hasOwnProperty(fe)&&pe!==ye&&(pe!=null||ye!=null))switch(fe){case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(r(137,i));break;default:Gt(s,i,fe,pe,u,ye)}return;default:if(da(i)){for(var Kt in a)pe=a[Kt],a.hasOwnProperty(Kt)&&pe!==void 0&&!u.hasOwnProperty(Kt)&&pp(s,i,Kt,void 0,u,pe);for(xe in u)pe=u[xe],ye=a[xe],!u.hasOwnProperty(xe)||pe===ye||pe===void 0&&ye===void 0||pp(s,i,xe,pe,u,ye);return}}for(var le in a)pe=a[le],a.hasOwnProperty(le)&&pe!=null&&!u.hasOwnProperty(le)&&Gt(s,i,le,null,u,pe);for(Ee in u)pe=u[Ee],ye=a[Ee],!u.hasOwnProperty(Ee)||pe===ye||pe==null&&ye==null||Gt(s,i,Ee,pe,u,ye)}function wy(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function lk(){if(typeof performance.getEntriesByType=="function"){for(var s=0,i=0,a=performance.getEntriesByType("resource"),u=0;u<a.length;u++){var E=a[u],N=E.transferSize,D=E.initiatorType,K=E.duration;if(N&&K&&wy(D)){for(D=0,K=E.responseEnd,u+=1;u<a.length;u++){var ne=a[u],fe=ne.startTime;if(fe>K)break;var xe=ne.transferSize,Ee=ne.initiatorType;xe&&wy(Ee)&&(ne=ne.responseEnd,D+=xe*(ne<K?1:(K-fe)/(ne-fe)))}if(--u,i+=8*(N+D)/(E.duration/1e3),s++,10<s)break}}if(0<s)return i/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var mp=null,vp=null;function su(s){return s.nodeType===9?s:s.ownerDocument}function xy(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 Cy(s,i){if(s===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&i==="foreignObject"?0:s}function gp(s,i){return s==="textarea"||s==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var _p=null;function ck(){var s=window.event;return s&&s.type==="popstate"?s===_p?!1:(_p=s,!0):(_p=null,!1)}var Ey=typeof setTimeout=="function"?setTimeout:void 0,uk=typeof clearTimeout=="function"?clearTimeout:void 0,ky=typeof Promise=="function"?Promise:void 0,dk=typeof queueMicrotask=="function"?queueMicrotask:typeof ky<"u"?function(s){return ky.resolve(null).then(s).catch(hk)}:Ey;function hk(s){setTimeout(function(){throw s})}function dr(s){return s==="head"}function jy(s,i){var a=i,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),Ua(i);return}u--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")u++;else if(a==="html")al(s.ownerDocument.documentElement);else if(a==="head"){a=s.ownerDocument.head,al(a);for(var N=a.firstChild;N;){var D=N.nextSibling,K=N.nodeName;N[yt]||K==="SCRIPT"||K==="STYLE"||K==="LINK"&&N.rel.toLowerCase()==="stylesheet"||a.removeChild(N),N=D}}else a==="body"&&al(s.ownerDocument.body);a=E}while(a);Ua(i)}function Ay(s,i){var a=s;s=0;do{var u=a.nextSibling;if(a.nodeType===1?i?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(i?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),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 yp(s){var i=s.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var a=i;switch(i=i.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":yp(a),At(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}s.removeChild(a)}}function fk(s,i,a,u){for(;s.nodeType===1;){var E=a;if(s.nodeName.toLowerCase()!==i.toLowerCase()){if(!u&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(u){if(!s[yt])switch(i){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(N=s.getAttribute("rel"),N==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(N!==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(N=s.getAttribute("src"),(N!==(E.src==null?null:E.src)||s.getAttribute("type")!==(E.type==null?null:E.type)||s.getAttribute("crossorigin")!==(E.crossOrigin==null?null:E.crossOrigin))&&N&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(i==="input"&&s.type==="hidden"){var N=E.name==null?null:""+E.name;if(E.type==="hidden"&&s.getAttribute("name")===N)return s}else return s;if(s=zi(s.nextSibling),s===null)break}return null}function pk(s,i,a){if(i==="")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 Ry(s,i){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!i||(s=zi(s.nextSibling),s===null))return null;return s}function bp(s){return s.data==="$?"||s.data==="$~"}function Sp(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function mk(s,i){var a=s.ownerDocument;if(s.data==="$~")s._reactRetry=i;else if(s.data!=="$?"||a.readyState!=="loading")i();else{var u=function(){i(),a.removeEventListener("DOMContentLoaded",u)};a.addEventListener("DOMContentLoaded",u),s._reactRetry=u}}function zi(s){for(;s!=null;s=s.nextSibling){var i=s.nodeType;if(i===1||i===3)break;if(i===8){if(i=s.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return s}var wp=null;function Ty(s){s=s.nextSibling;for(var i=0;s;){if(s.nodeType===8){var a=s.data;if(a==="/$"||a==="/&"){if(i===0)return zi(s.nextSibling);i--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||i++}s=s.nextSibling}return null}function Ny(s){s=s.previousSibling;for(var i=0;s;){if(s.nodeType===8){var a=s.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(i===0)return s;i--}else a!=="/$"&&a!=="/&"||i++}s=s.previousSibling}return null}function My(s,i,a){switch(i=su(a),s){case"html":if(s=i.documentElement,!s)throw Error(r(452));return s;case"head":if(s=i.head,!s)throw Error(r(453));return s;case"body":if(s=i.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function al(s){for(var i=s.attributes;i.length;)s.removeAttributeNode(i[0]);At(s)}var Ui=new Map,Oy=new Set;function iu(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Nn=se.d;se.d={f:vk,r:gk,D:_k,C:yk,L:bk,m:Sk,X:xk,S:wk,M:Ck};function vk(){var s=Nn.f(),i=Kc();return s||i}function gk(s){var i=De(s);i!==null&&i.tag===5&&i.type==="form"?X_(i):Nn.r(s)}var Ba=typeof document>"u"?null:document;function Dy(s,i,a){var u=Ba;if(u&&typeof i=="string"&&i){var E=Qs(i);E='link[rel="'+s+'"][href="'+E+'"]',typeof a=="string"&&(E+='[crossorigin="'+a+'"]'),Oy.has(E)||(Oy.add(E),s={rel:s,crossOrigin:a,href:i},u.querySelector(E)===null&&(i=u.createElement("link"),zs(i,"link",s),ot(i),u.head.appendChild(i)))}}function _k(s){Nn.D(s),Dy("dns-prefetch",s,null)}function yk(s,i){Nn.C(s,i),Dy("preconnect",s,i)}function bk(s,i,a){Nn.L(s,i,a);var u=Ba;if(u&&s&&i){var E='link[rel="preload"][as="'+Qs(i)+'"]';i==="image"&&a&&a.imageSrcSet?(E+='[imagesrcset="'+Qs(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(E+='[imagesizes="'+Qs(a.imageSizes)+'"]')):E+='[href="'+Qs(s)+'"]';var N=E;switch(i){case"style":N=Ha(s);break;case"script":N=za(s)}Ui.has(N)||(s=v({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:s,as:i},a),Ui.set(N,s),u.querySelector(E)!==null||i==="style"&&u.querySelector(ol(N))||i==="script"&&u.querySelector(ll(N))||(i=u.createElement("link"),zs(i,"link",s),ot(i),u.head.appendChild(i)))}}function Sk(s,i){Nn.m(s,i);var a=Ba;if(a&&s){var u=i&&typeof i.as=="string"?i.as:"script",E='link[rel="modulepreload"][as="'+Qs(u)+'"][href="'+Qs(s)+'"]',N=E;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":N=za(s)}if(!Ui.has(N)&&(s=v({rel:"modulepreload",href:s},i),Ui.set(N,s),a.querySelector(E)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ll(N)))return}u=a.createElement("link"),zs(u,"link",s),ot(u),a.head.appendChild(u)}}}function wk(s,i,a){Nn.S(s,i,a);var u=Ba;if(u&&s){var E=Ze(u).hoistableStyles,N=Ha(s);i=i||"default";var D=E.get(N);if(!D){var K={loading:0,preload:null};if(D=u.querySelector(ol(N)))K.loading=5;else{s=v({rel:"stylesheet",href:s,"data-precedence":i},a),(a=Ui.get(N))&&xp(s,a);var ne=D=u.createElement("link");ot(ne),zs(ne,"link",s),ne._p=new Promise(function(fe,xe){ne.onload=fe,ne.onerror=xe}),ne.addEventListener("load",function(){K.loading|=1}),ne.addEventListener("error",function(){K.loading|=2}),K.loading|=4,nu(D,i,u)}D={type:"stylesheet",instance:D,count:1,state:K},E.set(N,D)}}}function xk(s,i){Nn.X(s,i);var a=Ba;if(a&&s){var u=Ze(a).hoistableScripts,E=za(s),N=u.get(E);N||(N=a.querySelector(ll(E)),N||(s=v({src:s,async:!0},i),(i=Ui.get(E))&&Cp(s,i),N=a.createElement("script"),ot(N),zs(N,"link",s),a.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},u.set(E,N))}}function Ck(s,i){Nn.M(s,i);var a=Ba;if(a&&s){var u=Ze(a).hoistableScripts,E=za(s),N=u.get(E);N||(N=a.querySelector(ll(E)),N||(s=v({src:s,async:!0,type:"module"},i),(i=Ui.get(E))&&Cp(s,i),N=a.createElement("script"),ot(N),zs(N,"link",s),a.head.appendChild(N)),N={type:"script",instance:N,count:1,state:null},u.set(E,N))}}function $y(s,i,a,u){var E=(E=ie.current)?iu(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"?(i=Ha(a.href),a=Ze(E).hoistableStyles,u=a.get(i),u||(u={type:"style",instance:null,count:0,state:null},a.set(i,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=Ha(a.href);var N=Ze(E).hoistableStyles,D=N.get(s);if(D||(E=E.ownerDocument||E,D={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},N.set(s,D),(N=E.querySelector(ol(s)))&&!N._p&&(D.instance=N,D.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),N||Ek(E,s,a,D.state))),i&&u===null)throw Error(r(528,""));return D}if(i&&u!==null)throw Error(r(529,""));return null;case"script":return i=a.async,a=a.src,typeof a=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=za(a),a=Ze(E).hoistableScripts,u=a.get(i),u||(u={type:"script",instance:null,count:0,state:null},a.set(i,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function Ha(s){return'href="'+Qs(s)+'"'}function ol(s){return'link[rel="stylesheet"]['+s+"]"}function Ly(s){return v({},s,{"data-precedence":s.precedence,precedence:null})}function Ek(s,i,a,u){s.querySelector('link[rel="preload"][as="style"]['+i+"]")?u.loading=1:(i=s.createElement("link"),u.preload=i,i.addEventListener("load",function(){return u.loading|=1}),i.addEventListener("error",function(){return u.loading|=2}),zs(i,"link",a),ot(i),s.head.appendChild(i))}function za(s){return'[src="'+Qs(s)+'"]'}function ll(s){return"script[async]"+s}function Iy(s,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var u=s.querySelector('style[data-href~="'+Qs(a.href)+'"]');if(u)return i.instance=u,ot(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"),ot(u),zs(u,"style",E),nu(u,a.precedence,s),i.instance=u;case"stylesheet":E=Ha(a.href);var N=s.querySelector(ol(E));if(N)return i.state.loading|=4,i.instance=N,ot(N),N;u=Ly(a),(E=Ui.get(E))&&xp(u,E),N=(s.ownerDocument||s).createElement("link"),ot(N);var D=N;return D._p=new Promise(function(K,ne){D.onload=K,D.onerror=ne}),zs(N,"link",u),i.state.loading|=4,nu(N,a.precedence,s),i.instance=N;case"script":return N=za(a.src),(E=s.querySelector(ll(N)))?(i.instance=E,ot(E),E):(u=a,(E=Ui.get(N))&&(u=v({},a),Cp(u,E)),s=s.ownerDocument||s,E=s.createElement("script"),ot(E),zs(E,"link",u),s.head.appendChild(E),i.instance=E);case"void":return null;default:throw Error(r(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(u=i.instance,i.state.loading|=4,nu(u,a.precedence,s));return i.instance}function nu(s,i,a){for(var u=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),E=u.length?u[u.length-1]:null,N=E,D=0;D<u.length;D++){var K=u[D];if(K.dataset.precedence===i)N=K;else if(N!==E)break}N?N.parentNode.insertBefore(s,N.nextSibling):(i=a.nodeType===9?a.head:a,i.insertBefore(s,i.firstChild))}function xp(s,i){s.crossOrigin==null&&(s.crossOrigin=i.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=i.referrerPolicy),s.title==null&&(s.title=i.title)}function Cp(s,i){s.crossOrigin==null&&(s.crossOrigin=i.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=i.referrerPolicy),s.integrity==null&&(s.integrity=i.integrity)}var ru=null;function Py(s,i,a){if(ru===null){var u=new Map,E=ru=new Map;E.set(a,u)}else E=ru,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 N=a[E];if(!(N[yt]||N[ve]||s==="link"&&N.getAttribute("rel")==="stylesheet")&&N.namespaceURI!=="http://www.w3.org/2000/svg"){var D=N.getAttribute(i)||"";D=s+D;var K=u.get(D);K?K.push(N):u.set(D,[N])}}return u}function By(s,i,a){s=s.ownerDocument||s,s.head.insertBefore(a,i==="title"?s.querySelector("head > title"):null)}function kk(s,i,a){if(a===1||i.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return s=i.disabled,typeof i.precedence=="string"&&s==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Hy(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function jk(s,i,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=Ha(u.href),N=i.querySelector(ol(E));if(N){i=N._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(s.count++,s=au.bind(s),i.then(s,s)),a.state.loading|=4,a.instance=N,ot(N);return}N=i.ownerDocument||i,u=Ly(u),(E=Ui.get(E))&&xp(u,E),N=N.createElement("link"),ot(N);var D=N;D._p=new Promise(function(K,ne){D.onload=K,D.onerror=ne}),zs(N,"link",u),a.instance=N}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(a,i),(i=a.state.preload)&&(a.state.loading&3)===0&&(s.count++,a=au.bind(s),i.addEventListener("load",a),i.addEventListener("error",a))}}var Ep=0;function Ak(s,i){return s.stylesheets&&s.count===0&&lu(s,s.stylesheets),0<s.count||0<s.imgCount?function(a){var u=setTimeout(function(){if(s.stylesheets&&lu(s,s.stylesheets),s.unsuspend){var N=s.unsuspend;s.unsuspend=null,N()}},6e4+i);0<s.imgBytes&&Ep===0&&(Ep=62500*lk());var E=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&lu(s,s.stylesheets),s.unsuspend)){var N=s.unsuspend;s.unsuspend=null,N()}},(s.imgBytes>Ep?50:800)+i);return s.unsuspend=a,function(){s.unsuspend=null,clearTimeout(u),clearTimeout(E)}}:null}function au(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)lu(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var ou=null;function lu(s,i){s.stylesheets=null,s.unsuspend!==null&&(s.count++,ou=new Map,i.forEach(Rk,s),ou=null,au.call(s))}function Rk(s,i){if(!(i.state.loading&4)){var a=ou.get(s);if(a)var u=a.get(null);else{a=new Map,ou.set(s,a);for(var E=s.querySelectorAll("link[data-precedence],style[data-precedence]"),N=0;N<E.length;N++){var D=E[N];(D.nodeName==="LINK"||D.getAttribute("media")!=="not all")&&(a.set(D.dataset.precedence,D),u=D)}u&&a.set(null,u)}E=i.instance,D=E.getAttribute("data-precedence"),N=a.get(D)||u,N===u&&a.set(null,E),a.set(D,E),this.count++,u=au.bind(this),E.addEventListener("load",u),E.addEventListener("error",u),N?N.parentNode.insertBefore(E,N.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(E,s.firstChild)),i.state.loading|=4}}var cl={$$typeof:_,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function Tk(s,i,a,u,E,N,D,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=Ge(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ge(0),this.hiddenUpdates=Ge(null),this.identifierPrefix=u,this.onUncaughtError=E,this.onCaughtError=N,this.onRecoverableError=D,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ne,this.incompleteTransitions=new Map}function zy(s,i,a,u,E,N,D,K,ne,fe,xe,Ee){return s=new Tk(s,i,a,D,ne,fe,xe,Ee,K),i=1,N===!0&&(i|=24),N=bi(3,null,null,i),s.current=N,N.stateNode=s,i=nf(),i.refCount++,s.pooledCache=i,i.refCount++,N.memoizedState={element:u,isDehydrated:a,cache:i},lf(N),s}function Uy(s){return s?(s=_a,s):_a}function qy(s,i,a,u,E,N){E=Uy(E),u.context===null?u.context=E:u.pendingContext=E,u=er(i),u.payload={element:a},N=N===void 0?null:N,N!==null&&(u.callback=N),a=tr(s,u,i),a!==null&&(fi(a,s,i),zo(a,s,i))}function Fy(s,i){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var a=s.retryLane;s.retryLane=a!==0&&a<i?a:i}}function kp(s,i){Fy(s,i),(s=s.alternate)&&Fy(s,i)}function Vy(s){if(s.tag===13||s.tag===31){var i=Tr(s,67108864);i!==null&&fi(i,s,67108864),kp(s,67108864)}}function Wy(s){if(s.tag===13||s.tag===31){var i=Ei();i=Ks(i);var a=Tr(s,i);a!==null&&fi(a,s,i),kp(s,i)}}var cu=!0;function Nk(s,i,a,u){var E=W.T;W.T=null;var N=se.p;try{se.p=2,jp(s,i,a,u)}finally{se.p=N,W.T=E}}function Mk(s,i,a,u){var E=W.T;W.T=null;var N=se.p;try{se.p=8,jp(s,i,a,u)}finally{se.p=N,W.T=E}}function jp(s,i,a,u){if(cu){var E=Ap(u);if(E===null)fp(s,i,u,uu,a),Ky(s,u);else if(Dk(E,s,i,a,u))u.stopPropagation();else if(Ky(s,u),i&4&&-1<Ok.indexOf(s)){for(;E!==null;){var N=De(E);if(N!==null)switch(N.tag){case 3:if(N=N.stateNode,N.current.memoizedState.isDehydrated){var D=Ds(N.pendingLanes);if(D!==0){var K=N;for(K.pendingLanes|=2,K.entangledLanes|=2;D;){var ne=1<<31-ts(D);K.entanglements[1]|=ne,D&=~ne}ln(N),(Lt&6)===0&&(Wc=Ke()+500,il(0))}}break;case 31:case 13:K=Tr(N,2),K!==null&&fi(K,N,2),Kc(),kp(N,2)}if(N=Ap(u),N===null&&fp(s,i,u,uu,a),N===E)break;E=N}E!==null&&u.stopPropagation()}else fp(s,i,u,null,a)}}function Ap(s){return s=fa(s),Rp(s)}var uu=null;function Rp(s){if(uu=null,s=_e(s),s!==null){var i=c(s);if(i===null)s=null;else{var a=i.tag;if(a===13){if(s=f(i),s!==null)return s;s=null}else if(a===31){if(s=l(i),s!==null)return s;s=null}else if(a===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;s=null}else i!==s&&(s=null)}}return uu=s,null}function Gy(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(Ot()){case jt:return 2;case fs:return 8;case Dt:case xt:return 32;case gs:return 268435456;default:return 32}default:return 32}}var Tp=!1,hr=null,fr=null,pr=null,ul=new Map,dl=new Map,mr=[],Ok="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 Ky(s,i){switch(s){case"focusin":case"focusout":hr=null;break;case"dragenter":case"dragleave":fr=null;break;case"mouseover":case"mouseout":pr=null;break;case"pointerover":case"pointerout":ul.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":dl.delete(i.pointerId)}}function hl(s,i,a,u,E,N){return s===null||s.nativeEvent!==N?(s={blockedOn:i,domEventName:a,eventSystemFlags:u,nativeEvent:N,targetContainers:[E]},i!==null&&(i=De(i),i!==null&&Vy(i)),s):(s.eventSystemFlags|=u,i=s.targetContainers,E!==null&&i.indexOf(E)===-1&&i.push(E),s)}function Dk(s,i,a,u,E){switch(i){case"focusin":return hr=hl(hr,s,i,a,u,E),!0;case"dragenter":return fr=hl(fr,s,i,a,u,E),!0;case"mouseover":return pr=hl(pr,s,i,a,u,E),!0;case"pointerover":var N=E.pointerId;return ul.set(N,hl(ul.get(N)||null,s,i,a,u,E)),!0;case"gotpointercapture":return N=E.pointerId,dl.set(N,hl(dl.get(N)||null,s,i,a,u,E)),!0}return!1}function Yy(s){var i=_e(s.target);if(i!==null){var a=c(i);if(a!==null){if(i=a.tag,i===13){if(i=f(a),i!==null){s.blockedOn=i,oe(s.priority,function(){Wy(a)});return}}else if(i===31){if(i=l(a),i!==null){s.blockedOn=i,oe(s.priority,function(){Wy(a)});return}}else if(i===3&&a.stateNode.current.memoizedState.isDehydrated){s.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}s.blockedOn=null}function du(s){if(s.blockedOn!==null)return!1;for(var i=s.targetContainers;0<i.length;){var a=Ap(s.nativeEvent);if(a===null){a=s.nativeEvent;var u=new a.constructor(a.type,a);ha=u,a.target.dispatchEvent(u),ha=null}else return i=De(a),i!==null&&Vy(i),s.blockedOn=a,!1;i.shift()}return!0}function Xy(s,i,a){du(s)&&a.delete(i)}function $k(){Tp=!1,hr!==null&&du(hr)&&(hr=null),fr!==null&&du(fr)&&(fr=null),pr!==null&&du(pr)&&(pr=null),ul.forEach(Xy),dl.forEach(Xy)}function hu(s,i){s.blockedOn===i&&(s.blockedOn=null,Tp||(Tp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,$k)))}var fu=null;function Jy(s){fu!==s&&(fu=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){fu===s&&(fu=null);for(var i=0;i<s.length;i+=3){var a=s[i],u=s[i+1],E=s[i+2];if(typeof u!="function"){if(Rp(u||a)===null)continue;break}var N=De(a);N!==null&&(s.splice(i,3),i-=3,Af(N,{pending:!0,data:E,method:a.method,action:u},u,E))}}))}function Ua(s){function i(ne){return hu(ne,s)}hr!==null&&hu(hr,s),fr!==null&&hu(fr,s),pr!==null&&hu(pr,s),ul.forEach(i),dl.forEach(i);for(var a=0;a<mr.length;a++){var u=mr[a];u.blockedOn===s&&(u.blockedOn=null)}for(;0<mr.length&&(a=mr[0],a.blockedOn===null);)Yy(a),a.blockedOn===null&&mr.shift();if(a=(s.ownerDocument||s).$$reactFormReplay,a!=null)for(u=0;u<a.length;u+=3){var E=a[u],N=a[u+1],D=E[Se]||null;if(typeof N=="function")D||Jy(a);else if(D){var K=null;if(N&&N.hasAttribute("formAction")){if(E=N,D=N[Se]||null)K=D.formAction;else if(Rp(E)!==null)continue}else K=D.action;typeof K=="function"?a[u+1]=K:(a.splice(u,3),u-=3),Jy(a)}}}function Zy(){function s(N){N.canIntercept&&N.info==="react-transition"&&N.intercept({handler:function(){return new Promise(function(D){return E=D})},focusReset:"manual",scroll:"manual"})}function i(){E!==null&&(E(),E=null),u||setTimeout(a,20)}function a(){if(!u&&!navigation.transition){var N=navigation.currentEntry;N&&N.url!=null&&navigation.navigate(N.url,{state:N.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,E=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(a,100),function(){u=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),E!==null&&(E(),E=null)}}}function Np(s){this._internalRoot=s}pu.prototype.render=Np.prototype.render=function(s){var i=this._internalRoot;if(i===null)throw Error(r(409));var a=i.current,u=Ei();qy(a,u,s,i,null,null)},pu.prototype.unmount=Np.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var i=s.containerInfo;qy(s.current,2,null,s,null,null),Kc(),i[Me]=null}};function pu(s){this._internalRoot=s}pu.prototype.unstable_scheduleHydration=function(s){if(s){var i=Mi();s={blockedOn:null,target:s,priority:i};for(var a=0;a<mr.length&&i!==0&&i<mr[a].priority;a++);mr.splice(a,0,s),a===0&&Yy(s)}};var Qy=t.version;if(Qy!=="19.2.7")throw Error(r(527,Qy,"19.2.7"));se.findDOMNode=function(s){var i=s._reactInternals;if(i===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=m(i),s=s!==null?y(s):null,s=s===null?null:s.stateNode,s};var Lk={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:W,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var mu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mu.isDisabled&&mu.supportsFiber)try{_s=mu.inject(Lk),Fe=mu}catch{}}return pl.createRoot=function(s,i){if(!o(s))throw Error(r(299));var a=!1,u="",E=a0,N=o0,D=l0;return i!=null&&(i.unstable_strictMode===!0&&(a=!0),i.identifierPrefix!==void 0&&(u=i.identifierPrefix),i.onUncaughtError!==void 0&&(E=i.onUncaughtError),i.onCaughtError!==void 0&&(N=i.onCaughtError),i.onRecoverableError!==void 0&&(D=i.onRecoverableError)),i=zy(s,1,!1,null,null,a,u,null,E,N,D,Zy),s[Me]=i.current,hp(s),new Np(i)},pl.hydrateRoot=function(s,i,a){if(!o(s))throw Error(r(299));var u=!1,E="",N=a0,D=o0,K=l0,ne=null;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(E=a.identifierPrefix),a.onUncaughtError!==void 0&&(N=a.onUncaughtError),a.onCaughtError!==void 0&&(D=a.onCaughtError),a.onRecoverableError!==void 0&&(K=a.onRecoverableError),a.formState!==void 0&&(ne=a.formState)),i=zy(s,1,!0,i,a??null,u,E,ne,N,D,K,Zy),i.context=Uy(null),a=i.current,u=Ei(),u=Ks(u),E=er(u),E.callback=null,tr(a,E,u),a=u,i.current.lanes=a,ke(i,a),ln(i),s[Me]=i.current,hp(s),new pu(i)},pl.version="19.2.7",pl}var cb;function Kk(){if(cb)return $p.exports;cb=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(),$p.exports=Gk(),$p.exports}var Yk=Kk();const Uw="sapiom-harness-theme",Hm=new Set;function Xk(){var e;return typeof window<"u"&&((e=window.matchMedia)==null?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)===!0}function Jk(){const e=typeof window<"u"?window.localStorage.getItem(Uw):null;return e==="light"||e==="dark"?e:Xk()?"dark":"light"}let Bv=Jk();function vh(){return Bv}function Zk(e){Bv=e,document.documentElement.dataset.theme=e,window.localStorage.setItem(Uw,e),Hm.forEach(t=>t(e))}function qw(){Zk(Bv==="dark"?"light":"dark")}function Hv(e){return Hm.add(e),()=>Hm.delete(e)}const Fw=Date.now(),Fs=e=>new Date(Fw-e*6e4).toISOString(),it=e=>new Date(Fw-e*24*60*6e4).toISOString(),ub="/Users/demo/acme-app";Fs(1),Fs(1),Fs(42),Fs(20),it(2),it(1),it(1),it(1),it(3),it(3),Fs(0),Fs(0),Fs(3),Fs(3);Fs(1),it(1),it(1),it(3),it(6),it(45),it(1);Fs(48),Fs(1),Fs(48),Fs(47),Fs(46),Fs(45),Fs(3),Fs(2),it(1),it(1),it(1),it(1),it(1),it(1),it(1),it(1),it(1),it(3),it(3),it(3),it(3),it(3),it(3),it(3),it(3),it(1),it(1),it(1),it(1),it(45),it(45),it(45),it(45),it(45),it(45),it(45),it(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:it(e),source:"transcript",resumeMode:"rehydrate",turnCount:6-t})),it(3),it(1),it(6)];function zv(){return!1}function ro(e){return(e==null?void 0:e.boundWorkflowPath)??null}class ji extends Error{constructor(n,r,o){super(r);Mp(this,"status");Mp(this,"reason");this.name="ApiError",this.status=n,this.reason=o}}function ao(){const e=window.__HARNESS__;return e!=null&&e.token?e.token:new URLSearchParams(window.location.search).get("token")??""}class Qk{startAuth(){return this.request("/api/auth/start",{method:"POST"})}disconnect(){return this.request("/api/auth/disconnect",{method:"POST"})}authStatus(){return this.request("/api/auth/status")}async request(t,n){const r=await fetch(t,{...n,headers:{"Content-Type":"application/json","X-Harness-Token":ao(),...n==null?void 0:n.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,`${(n==null?void 0:n.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:vh(),...t})})}listSessions(){return this.request("/api/sessions")}sessionHistory(t){return this.request(`/api/sessions/history?cwd=${encodeURIComponent(t)}`)}async sessionRecord(t){try{return await this.request(`/api/sessions/${encodeURIComponent(t)}/record`)}catch(n){if(n instanceof ji&&(n.status===404||n.status===501))return null;throw n}}resumeSession(t){return this.request(`/api/sessions/${encodeURIComponent(t)}/resume`,{method:"POST"})}adoptSession(t){return this.request("/api/sessions/adopt",{method:"POST",body:JSON.stringify(t)})}async killSession(t){await this.request(`/api/sessions/${encodeURIComponent(t)}`,{method:"DELETE"})}async injectInput(t,n){await this.request(`/api/sessions/${encodeURIComponent(t)}/input`,{method:"POST",body:JSON.stringify(n)})}listWorkflows(){return this.request("/api/workflows")}getWorkflowInputContract(t){return this.request(`/api/workflows/${encodeURIComponent(t)}/input-contract`)}connectWorkflow(t){return this.request("/api/workflows/connect",{method:"POST",body:JSON.stringify({path:t})})}scanWorkflows(t){return this.request("/api/workflows/scan",{method:"POST",body:JSON.stringify({root:t})})}listHarnesses(){return this.request("/api/harnesses")}listMacros(){return this.request("/api/macros")}async runMacro(t,n){await this.request(`/api/macros/${encodeURIComponent(t)}/run`,{method:"POST",body:JSON.stringify(n)})}getSettings(){return this.request("/api/settings")}updateSettings(t){return this.request("/api/settings",{method:"PATCH",body:JSON.stringify(t)})}listDir(t){const n=t?`?path=${encodeURIComponent(t)}`:"";return this.request(`/api/fs/list${n}`)}bindWorkflow(t,n){const r={workflowPath:n};return this.request(`/api/sessions/${encodeURIComponent(t)}/workflow`,{method:"PATCH",body:JSON.stringify(r)})}listTemplates(){return this.request("/api/templates")}getTemplate(t){return this.request(`/api/templates/${encodeURIComponent(t)}`)}getAccountPlan(){return this.request("/api/account/plan")}getRunState(t){return this.request(`/api/runs/${encodeURIComponent(t)}/state`)}async runLocal(t,n){const r=await fetch("/api/runs/local",{method:"POST",headers:{"Content-Type":"application/json","X-Harness-Token":ao()},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}=tj(f,m);f=v;for(const S of y){const w=sj(S);w&&n(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,n){const r=await this.streamNdjson(`/api/workflows/${encodeURIComponent(t)}/deploy`,{method:"POST"},n);return ij(r)}async run(t){return this.request("/api/runs",{method:"POST",body:JSON.stringify(t)})}async streamNdjson(t,n,r){const o=await fetch(t,{...n,headers:{"Content-Type":"application/json","X-Harness-Token":ao(),...n.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,`${n.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=ej(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 ej(e){const t=e.trim();if(t==="")return;let n;try{n=JSON.parse(t)}catch{return}return n===null?void 0:n}function tj(e,t){const n=e.split(`
|
|
53
|
-
`);if(t)return{lines:n.filter(o=>o.trim()!==""),rest:""};const r=n.pop()??"";return{lines:n.filter(o=>o.trim()!==""),rest:r}}function sj(e){const t=e.trim();if(t==="")return null;let n;try{n=JSON.parse(t)}catch{return null}return typeof n!="object"||n===null||Array.isArray(n)?null:n}function ij(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.phase==="ready"||n.phase==="error")return n}return{phase:"error",code:"NO_OUTPUT",message:"deploy produced no terminal status"}}function Vw(){return new Qk}function Ll(e){var r,o;const t=(r=e.inputSchema)==null?void 0:r.properties;if(!t)return[];const n=new Set(((o=e.inputSchema)==null?void 0:o.required)??[]);return Object.entries(t).map(([c,f])=>({name:c,type:typeof(f==null?void 0:f.type)=="string"?f.type:"unknown",required:n.has(c)})).sort((c,f)=>Number(f.required)-Number(c.required))}function Wn(e){return e<1e3?`${e}ms`:`${Math.round(e/100)/10}s`}function nj(e,t){const n=[],r=Ll(e).length;r>0&&n.push(r===1?"1 input":`${r} inputs`);const o=t.filter(c=>c.from===e.id&&c.kind==="branching").length;return o>1&&n.push(`${o} branches`),e.timeoutMs&&e.timeoutMs>0&&n.push(`${Wn(e.timeoutMs)} limit`),n}function rj(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 aj(e){const{steps:t,exits:n}=rj(e),r=[`${t} ${t===1?"step":"steps"}`];return n>0&&r.push(`${n} ${n===1?"exit":"exits"}`),r.join(" · ")}function Ww(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 zm(e,t=0){if(!(t>32)){if(e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(n=>zm(n,t+1));if(typeof e=="object")return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,zm(r,t+1)]).filter(n=>n[1]!==void 0))}}function oj(e){if(!e||typeof e!="object")return null;const t=zm(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function lj(e){if(!e||typeof e!="object")return null;const t=e;if(!Array.isArray(t.nodes)||!Array.isArray(t.edges))return null;const n=r=>typeof r=="string"?r:"";return{name:n(t.name),entry:n(t.entry),nodes:t.nodes.map(r=>({id:n(r.id),kind:n(r.kind),label:n(r.label),role:n(r.role),description:n(r.description),timeoutMs:typeof r.timeoutMs=="number"&&r.timeoutMs>0?r.timeoutMs:null,inputSchema:oj(r.inputSchema),capabilities:Array.isArray(r.capabilities)?r.capabilities.filter(o=>typeof o=="string"):[]})),edges:t.edges.map(r=>({from:n(r.from),to:n(r.to),kind:n(r.kind),label:n(r.label)})),groups:Array.isArray(t.groups)?t.groups.map(r=>({label:n(r.label),nodeIds:Array.isArray(r.nodeIds)?r.nodeIds.filter(o=>typeof o=="string"):[]})):[],warnings:Array.isArray(t.warnings)?t.warnings.filter(r=>typeof r=="string"):[]}}const Gw="sapiom-harness-ui-prefs";function dn(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Gw);return e?JSON.parse(e):{}}catch{return{}}}function Vn(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Gw,JSON.stringify({...dn(),...e}))}catch{}}function Uv(e,t){return!e||e.stubbed!==!0?!1:e.steps.some(n=>n.name===t)}function cj(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 gh(e,t){if(!e)return null;for(let n=e.steps.length-1;n>=0;n--)if(e.steps[n].name===t)return e.steps[n];return null}const db=3e3,hb=2e3;function uj(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function fb(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>hb?`${t.slice(0,hb)}
|
|
54
|
-
… (truncated, ${t.length} chars total)`:t}function dj(e,t,n){const r=[];r.push(`Step: ${e.name}`),r.push(`Status: ${e.status}`),e.latencyMs!=null&&r.push(`Latency: ${uj(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
|
-
${fb(t.input)}`),(t==null?void 0:t.output)!==void 0&&r.push(`
|
|
57
|
-
Output:
|
|
58
|
-
${fb(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(n!=null&&n.capabilities&&n.capabilities.length>0){r.push(`
|
|
61
|
-
Capabilities declared (no call trace):`);for(const c of n.capabilities)r.push(` - ${c}`)}if(t!=null&&t.unusedStubs&&t.unusedStubs.length>0){r.push(`
|
|
62
|
-
Unused stubs (supplied but matched no call):`);for(const c of t.unusedStubs)r.push(` - ${c}`)}if(t!=null&&t.stubWarnings&&t.stubWarnings.length>0){r.push(`
|
|
63
|
-
Stub warnings:`);for(const c of t.stubWarnings)r.push(` - ${c}`)}if(e.logSlice){const c=e.logSlice.trimEnd(),f=c.length>db?c.slice(c.length-db):c;r.push(`
|
|
64
|
-
Logs:
|
|
65
|
-
${f}`)}return r.join(`
|
|
66
|
-
`)}const hj=/\.(png|jpg|jpeg|webp|gif|svg)($|\?)/i,fj=/https?:\/\/[^\s"'<>`\])\]]+/gi,pj=/[.,;:)\]}\s]+$/;function pb(e){if(typeof e=="string")return e;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function mj(e){const t=new Set,n=[],r=o=>{const c=o.matchAll(fj);for(const[f]of c){const l=f.replace(pj,"");if(!l||t.has(l))continue;t.add(l);const d=hj.test(l)?"image":"other";n.push({url:l,kind:d})}};if(e.output!==void 0&&r(pb(e.output)),e.logSlice&&r(e.logSlice),e.calls)for(const o of e.calls)o.result!==void 0&&r(pb(o.result));return n}const _h="https://app.sapiom.ai",Kw=`${_h}/agents`,mb=`${_h}/settings?tab=billing`,vj=_h;function yh(e){return`${Kw}/${e}`}const gj="https://docs.sapiom.ai",_j=`${gj}/agents/quick-start`;function Yw(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 Xw=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
|
|
72
|
-
* @license lucide-react v1.23.0 - ISC
|
|
73
|
-
*
|
|
74
|
-
* This source code is licensed under the ISC license.
|
|
75
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/const yj=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 bj=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
|
|
82
|
-
* @license lucide-react v1.23.0 - ISC
|
|
83
|
-
*
|
|
84
|
-
* This source code is licensed under the ISC license.
|
|
85
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const vb=e=>{const t=bj(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 Bp={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 Sj=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},wj=U.createContext({}),xj=()=>U.useContext(wj),Cj=U.forwardRef(({color:e,size:t,strokeWidth:n,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=""}=xj()??{},R=r??v?Number(n??y)*24/Number(t??m):n??y;return U.createElement("svg",{ref:d,...Bp,width:t??m??Bp.width,height:t??m??Bp.height,stroke:e??S,strokeWidth:R,className:Xw("lucide",w,o),...!c&&!Sj(l)&&{"aria-hidden":"true"},...l},[...f.map(([x,g])=>U.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 Pe=(e,t)=>{const n=U.forwardRef(({className:r,...o},c)=>U.createElement(Cj,{ref:c,iconNode:t,className:Xw(`lucide-${yj(vb(e))}`,`lucide-${e}`,r),...o}));return n.displayName=vb(e),n};/**
|
|
102
|
-
* @license lucide-react v1.23.0 - ISC
|
|
103
|
-
*
|
|
104
|
-
* This source code is licensed under the ISC license.
|
|
105
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
-
*/const Ej=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],kj=Pe("arrow-down",Ej);/**
|
|
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 jj=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Aj=Pe("arrow-left",jj);/**
|
|
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 Rj=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Tj=Pe("arrow-right",Rj);/**
|
|
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 Nj=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Mj=Pe("arrow-up-right",Nj);/**
|
|
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 Oj=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Dj=Pe("arrow-up",Oj);/**
|
|
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 $j=[["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"}]],Lj=Pe("book-open",$j);/**
|
|
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 Ij=[["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"}]],Pj=Pe("brain",Ij);/**
|
|
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 Bj=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Hj=Pe("check",Bj);/**
|
|
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 zj=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Uj=Pe("chevron-down",zj);/**
|
|
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 qj=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Fj=Pe("chevron-right",qj);/**
|
|
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 Vj=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Wj=Pe("chevron-up",Vj);/**
|
|
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 Gj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Kj=Pe("circle-check",Gj);/**
|
|
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 Yj=[["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"}]],Xj=Pe("circle-question-mark",Yj);/**
|
|
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 Jj=[["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"}]],Zj=Pe("cloud-off",Jj);/**
|
|
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 Qj=[["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"}]],eA=Pe("cloud-upload",Qj);/**
|
|
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 tA=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],sA=Pe("cloud",tA);/**
|
|
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 iA=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],nA=Pe("code",iA);/**
|
|
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 rA=[["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"}]],aA=Pe("copy",rA);/**
|
|
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 oA=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],lA=Pe("corner-down-right",oA);/**
|
|
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 cA=[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]],uA=Pe("corner-left-up",cA);/**
|
|
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 dA=[["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"}]],hA=Pe("ellipsis-vertical",dA);/**
|
|
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 fA=[["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"}]],pA=Pe("ellipsis",fA);/**
|
|
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 mA=[["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"}]],vA=Pe("external-link",mA);/**
|
|
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 gA=[["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"}]],_A=Pe("flask-conical",gA);/**
|
|
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 yA=[["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"}]],bA=Pe("folder-open",yA);/**
|
|
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 SA=[["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"}]],wA=Pe("folder-plus",SA);/**
|
|
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 xA=[["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"}]],CA=Pe("folder",xA);/**
|
|
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 EA=[["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"}]],kA=Pe("frame",EA);/**
|
|
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 jA=[["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"}]],AA=Pe("globe",jA);/**
|
|
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 RA=[["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"}]],TA=Pe("hammer",RA);/**
|
|
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 NA=[["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"}]],MA=Pe("history",NA);/**
|
|
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 OA=[["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"}]],DA=Pe("image-up",OA);/**
|
|
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 $A=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],LA=Pe("info",$A);/**
|
|
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 IA=[["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"}]],PA=Pe("layout-template",IA);/**
|
|
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 BA=[["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"}]],HA=Pe("list-checks",BA);/**
|
|
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 zA=[["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"}]],UA=Pe("list",zA);/**
|
|
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 qA=[["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"}]],FA=Pe("loader",qA);/**
|
|
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 VA=[["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"}]],WA=Pe("log-out",VA);/**
|
|
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 GA=[["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"}]],KA=Pe("maximize-2",GA);/**
|
|
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 YA=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],XA=Pe("menu",YA);/**
|
|
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 JA=[["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"}]],ZA=Pe("message-square",JA);/**
|
|
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 QA=[["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"}]],eR=Pe("minimize-2",QA);/**
|
|
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 tR=[["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"}]],sR=Pe("moon",tR);/**
|
|
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 iR=[["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"}]],nR=Pe("panel-left-close",iR);/**
|
|
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 rR=[["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"}]],aR=Pe("panel-left-open",rR);/**
|
|
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 oR=[["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"}]],lR=Pe("panel-right-close",oR);/**
|
|
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 cR=[["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"}]],uR=Pe("panel-right-open",cR);/**
|
|
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 dR=[["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"}]],hR=Pe("paperclip",dR);/**
|
|
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 fR=[["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"}]],pR=Pe("pencil",fR);/**
|
|
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 mR=[["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"}]],vR=Pe("play",mR);/**
|
|
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 gR=[["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"}]],_R=Pe("plug",gR);/**
|
|
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 yR=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],bR=Pe("plus",yR);/**
|
|
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 SR=[["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"}]],wR=Pe("radio",SR);/**
|
|
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 xR=[["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"}]],CR=Pe("refresh-cw",xR);/**
|
|
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 ER=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],kR=Pe("search",ER);/**
|
|
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 jR=[["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"}]],AR=Pe("settings",jR);/**
|
|
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 RR=[["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"}]],TR=Pe("sparkles",RR);/**
|
|
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 NR=[["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"}]],MR=Pe("square-terminal",NR);/**
|
|
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 OR=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],DR=Pe("square",OR);/**
|
|
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 $R=[["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"}]],LR=Pe("sun",$R);/**
|
|
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 IR=[["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"}]],PR=Pe("tags",IR);/**
|
|
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 BR=[["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"}]],HR=Pe("trash-2",BR);/**
|
|
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 zR=[["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"}]],UR=Pe("triangle-alert",zR);/**
|
|
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 qR=[["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"}]],FR=Pe("wand-sparkles",qR);/**
|
|
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 VR=[["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"}]],WR=Pe("workflow",VR);/**
|
|
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 GR=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],KR=Pe("x",GR);/**
|
|
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 YR=[["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"}]],XR=Pe("zap",YR);/**
|
|
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 JR=[["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"}]],ZR=Pe("zoom-in",JR);/**
|
|
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 QR=[["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"}]],eT=Pe("zoom-out",QR),tT={ArrowDown:kj,ArrowLeft:Aj,ArrowRight:Tj,ArrowUp:Dj,ArrowUpRight:Mj,BookOpen:Lj,Brain:Pj,Check:Hj,ChevronDown:Uj,ChevronRight:Fj,ChevronUp:Wj,CircleCheck:Kj,Cloud:sA,CloudOff:Zj,CloudUpload:eA,Code:nA,Copy:aA,CornerDownRight:lA,CornerLeftUp:uA,ExternalLink:vA,FlaskConical:_A,Folder:CA,FolderOpen:bA,FolderPlus:wA,Frame:kA,Globe:AA,Hammer:TA,History:MA,ImageUp:DA,Info:LA,LayoutTemplate:PA,List:UA,ListChecks:HA,Loader:FA,LogOut:WA,Maximize2:KA,Menu:XA,MessageSquare:ZA,Minimize2:eR,MoreHorizontal:pA,MoreVertical:hA,Moon:sR,PanelLeftClose:nR,PanelLeftOpen:aR,PanelRightClose:lR,PanelRightOpen:uR,Paperclip:hR,Pencil:pR,Play:vR,Plug:_R,Plus:bR,Radio:wR,RefreshCw:CR,Search:kR,Settings:AR,Sparkles:TR,Square:DR,SquareTerminal:MR,Sun:LR,Tags:PR,Trash2:HR,TriangleAlert:UR,Wand2:FR,Workflow:WR,X:KR,Zap:XR,ZoomIn:ZR,ZoomOut:eT};function de({name:e,size:t=16}){const n=tT[e]??Xj;return h.jsx(n,{size:t,strokeWidth:1.75,"aria-hidden":"true"})}const sT="data-ph-capture-attribute-";function Ft(e){const t={};for(const[n,r]of Object.entries(e)){if(r==null)continue;const o=String(r);o.length!==0&&(t[`${sT}${n}`]=o)}return t}const qa=8,iT=1200,gb=12;function nT(e){return/<\/?(?:!doctype|html|head|body|style|script|main|section|article|div|span|img|svg|meta|link)\b/i.test(e)}function rT(e){const t=e.split(/\r?\n/),r=t.slice(0,gb).join(`
|
|
447
|
-
`).slice(0,iT),o=t.length>gb||e.length>r.length;return{kind:nT(e)?"html":"text",truncated:o,preview:o?`${r.trimEnd()}
|
|
448
|
-
…`:e,omittedCharacters:o?Math.max(0,e.length-r.length):0}}function aT(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 Jw(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"?t:null}catch{return null}}function oT(e){var t;return((t=e.pathname.split(".").pop())==null?void 0:t.toLowerCase())??""}function Zw(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 lT({url:e}){const[t,n]=U.useState(!1),r=oT(e),o=Zw(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:()=>n(!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:()=>n(!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:()=>n(!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 Hp(e){const t=[],n=/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)|(https?:\/\/[^\s<]+)/g;let r=0,o;for(;o=n.exec(e);){o.index>r&&t.push(e.slice(r,o.index));const c=o[2]??o[3],f=c?Jw(c.replace(/[.,;!?]+$/,"")):null;f?t.push(h.jsx("a",{href:f.href,target:"_blank",rel:"noreferrer",children:o[1]??Zw(f)},`${o.index}-${f.href}`)):t.push(o[0]),r=n.lastIndex}return r<e.length&&t.push(e.slice(r)),t}function cT({text:e}){const t=e.split(/\r?\n/),n=[];let r=[],o=[];const c=()=>{if(r.length===0)return;const l=r.join(`
|
|
449
|
-
`);n.push(h.jsx("p",{children:Hp(l)},`p-${n.length}`)),r=[]},f=()=>{o.length!==0&&(n.push(h.jsx("ul",{children:o.map((l,d)=>h.jsx("li",{children:Hp(l)},d))},`l-${n.length}`)),o=[])};for(const l of t){const d=/^(#{1,3})\s+(.+)$/.exec(l),m=/^[-*]\s+(.+)$/.exec(l);if(d){c(),f();const y=Hp(d[2]);n.push(d[1].length===1?h.jsx("h3",{children:y},n.length):d[1].length===2?h.jsx("h4",{children:y},n.length):h.jsx("h5",{children:y},n.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:n})}function Qw({text:e,forceSource:t=!1}){const[n,r]=U.useState(!1);U.useEffect(()=>r(!1),[e]);const o=rT(e),c=t||o.kind==="html",f=n?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(cT,{text:f}),o.truncated&&h.jsxs("button",{type:"button",className:"btn-ghost artifact-text-more","aria-expanded":n,onClick:()=>r(l=>!l),children:[h.jsx(de,{name:n?"ChevronUp":"ChevronDown",size:12}),n?"Show less":`Show full ${c?"HTML":"text"} · ${o.omittedCharacters.toLocaleString()} more characters`]})]})}function zp(e){return e!==null&&typeof e=="object"}function Rd({value:e}){if(typeof e=="string"){const t=Jw(e);return t?h.jsx(lT,{url:t},t.href):h.jsx(Qw,{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,qa),n=e.slice(qa);return h.jsxs("div",{className:"artifact-list",children:[t.map((r,o)=>h.jsxs("div",{className:"artifact-list-item","data-composite":zp(r)||void 0,children:[h.jsx("span",{className:"artifact-list-index",children:o+1}),h.jsx(Rd,{value:r})]},o)),n.length>0&&h.jsxs("details",{className:"artifact-collection-more",children:[h.jsxs("summary",{children:["Show ",n.length," more"]}),n.map((r,o)=>h.jsxs("div",{className:"artifact-list-item","data-composite":zp(r)||void 0,children:[h.jsx("span",{className:"artifact-list-index",children:o+qa+1}),h.jsx(Rd,{value:r})]},o+qa))]})]})}if(typeof e=="object"){const t=Object.entries(e);if(t.length===0)return h.jsx("code",{className:"artifact-scalar",children:"{}"});const n=t.slice(0,qa),r=t.slice(qa),o=c=>c.map(([f,l])=>h.jsxs("div",{className:"artifact-field","data-composite":zp(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(Rd,{value:l})})]},f));return h.jsxs("div",{className:"artifact-object",children:[o(n),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 Il({value:e,label:t="Result",testId:n="run-artifact",defaultOpen:r=!0,onViewed:o,viewEventKey:c="default"}){const[f,l]=U.useState("rendered"),[d,m]=U.useState(r),[y,v]=U.useState(!1),S=U.useRef(null),w=U.useRef(null),R=U.useId(),x=U.useId(),g=U.useId(),b=U.useRef(null),p=U.useRef(null),_=Yw(e);U.useEffect(()=>{!o||S.current===c||(S.current=c,o())},[o,c]),U.useEffect(()=>()=>{w.current&&window.clearTimeout(w.current)},[]);const k=C=>{l(C),m(!0)},j=C=>{var A;let T=null;C.key==="Home"&&(T="rendered"),C.key==="End"&&(T="raw"),["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(C.key)&&(T=f==="rendered"?"raw":"rendered"),T!==null&&(C.preventDefault(),k(T),(A=(T==="rendered"?b:p).current)==null||A.focus())};return h.jsxs("section",{className:"artifact-renderer","data-testid":n,"data-collapsed":!d||void 0,...Ft({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:j,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:j,onClick:()=>k("raw"),children:"Raw"})]}),h.jsxs("button",{type:"button",className:"btn-ghost artifact-copy",onClick:()=>void(async()=>{var T;let C=!1;try{(T=navigator.clipboard)!=null&&T.writeText&&(await navigator.clipboard.writeText(_),C=!0)}catch{}C||(C=aT(_)),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(Rd,{value:e}):h.jsx(Qw,{text:_,forceSource:!0})})]})}function qv(){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 yr({label:e,value:t,testId:n}){return h.jsx(Il,{value:t,label:e,testId:n,defaultOpen:!1})}function uT({links:e,testid:t}){return h.jsx("div",{className:"canvas-links-list","data-testid":t,children:e.map(({url:n,kind:r})=>r==="image"?h.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:"canvas-link-thumb-wrap","data-testid":"canvas-link-image",children:h.jsx("img",{src:n,alt:"",className:"canvas-link-thumb",loading:"lazy"})},n):h.jsxs("a",{href:n,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"})]},n))})}function ex({step:e}){const t=mj(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(uT,{links:t})]})}function dT({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 hT({deployState:e,workflow:t,onDismiss:n,onOpenCode:r}){const o=(t==null?void 0:t.definitionId)!=null?yh(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(dT,{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:n,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 tx({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,n)=>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(yr,{label:"Arguments",value:t.args,testId:`canvas-call-arguments-${t.capability}`}),t.result!==void 0&&h.jsx(yr,{label:"Result",value:t.result,testId:`canvas-call-result-${t.capability}`})]},`${t.capability}-${n}`))})]})}function sx({run:e}){const t=cj(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(n=>h.jsxs("li",{children:[h.jsx("code",{className:"canvas-input-field",children:n.key})," in ",n.step]},`${n.step} ${n.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(n=>h.jsx("li",{children:n},n))})]})]}):null}function fT(e){return e?`${e} run`:"run"}function Fv({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 vu(e){return e.kind==="branching"?"branch":e.kind==="cross"?"pause resume":e.kind==="launch"?"launch":null}function pT({node:e}){const t=Ll(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(n=>h.jsxs("code",{className:"canvas-input-field"+(n.required?" is-required":""),"aria-label":`${n.name}, ${n.type}${n.required?", required":""}`,...Ft({object:"run"}),children:[n.name,n.required&&h.jsx("span",{"aria-hidden":"true",children:"*"}),h.jsx("span",{className:"canvas-input-type",children:n.type})]},n.name))})]})}function mT({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 vT(e,t){return e.kind!=="launched-workflow"?null:t.find(n=>n.path===e.label)??t.find(n=>n.name===e.label)??t.find(n=>n.path.endsWith(`/${e.label}`))??null}function ix({node:e,workflows:t,onOpenWorkflow:n}){const r=vT(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:()=>n(r.path),children:["Open agent ",h.jsx(de,{name:"ArrowRight",size:12})]}):null}function gT({graph:e,run:t,runTarget:n,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:fT(n)})]}),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=nj(R,e.edges),p=gh(t,R.id),_=p?[p.latencyMs!==void 0?Wn(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(Fv,{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&&Uv(t,R.id)&&h.jsx(qv,{}),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(_T,{graph:e,node:R,run:t,workflows:r,onOpenWorkflow:o,onAskAgent:c})})]},R.id)})]},`${S.group??"ungrouped"}-${w}`))]})}function _T({graph:e,node:t,run:n,workflows:r,onOpenWorkflow:o,onAskAgent:c}){const f=gh(n,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(ix,{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(Fv,{status:f.status}),f.status,Uv(n,t.id)&&h.jsx(qv,{})]})]}),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:Wn(f.latencyMs)})]}),f.input!==void 0&&h.jsx(yr,{label:"Input",value:f.input,testId:`canvas-detail-run-input-${t.id}`}),f.output!==void 0&&h.jsx(yr,{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(yr,{label:"Logs",value:f.logSlice,testId:`canvas-detail-run-logs-${t.id}`})]}),f&&h.jsx(tx,{step:f}),f&&h.jsx(ex,{step:f}),h.jsx(sx,{run:n}),(Ll(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))})]}),Ll(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:Ll(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",...Ft({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:Wn(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)}),vu(v)&&h.jsx("span",{className:"canvas-detail-edge-kind",children:vu(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)}),vu(v)&&h.jsx("span",{className:"canvas-detail-edge-kind",children:vu(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 yT({node:e,run:t,workflows:n,onOpenWorkflow:r}){const o=gh(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(pT,{node:e}),h.jsx(mT,{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:Wn(e.timeoutMs)})]}),h.jsx(ix,{node:e,workflows:n,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(Fv,{status:o.status}),o.status,Uv(t,e.id)&&h.jsx(qv,{})]}),o.latencyMs!==void 0&&h.jsx("span",{className:"canvas-inspector-run-meta",children:Wn(o.latencyMs)})]}),(o==null?void 0:o.input)!==void 0&&h.jsx(yr,{label:"Input",value:o.input,testId:`canvas-inspector-run-input-${e.id}`}),(o==null?void 0:o.output)!==void 0&&h.jsx(yr,{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(yr,{label:"Logs",value:o.logSlice,testId:`canvas-inspector-run-logs-${e.id}`}),o&&h.jsx(tx,{step:o}),o&&h.jsx(ex,{step:o}),h.jsx(sx,{run:t})]})}function bT({node:e,run:t,onInjectPrompt:n,onClose:r}){const o=e?gh(t,e.id):null,[c,f]=U.useState("");function l(m){var w;if(!e){n(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=dj(o??{id:e.id,name:e.id,status:"pending"},y,v);n(`${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 _b=24;function ST({overview:e,selectedNode:t,graph:n,run:r,workflows:o,onOpenWorkflow:c,onOpenSteps:f,onDeselect:l,onCollapse:d,onDescribeWithAI:m,describing:y=!1}){var te;const v=U.useRef(null),S=U.useRef(null),w=U.useRef(null),R=U.useRef(null),x=U.useRef(dn().canvasInspectorHeight??null),[g,b]=U.useState(null),[p,_]=U.useState(!1),[k,j]=U.useState(!1),C=k||y;U.useEffect(()=>{y&&j(!1)},[y]),U.useEffect(()=>{if(!k)return;const W=window.setTimeout(()=>j(!1),8e3);return()=>window.clearTimeout(W)},[k]);const T=()=>{var se;const W=(se=v.current)==null?void 0:se.parentElement;return W?Math.round(W.getBoundingClientRect().height*.5):Number.MAX_SAFE_INTEGER},A=()=>{var W;return(((W=S.current)==null?void 0:W.offsetHeight)??40)+1},M=U.useCallback(()=>{const W=S.current,se=w.current,ee=R.current;if(!W||!se||!ee)return;const H=T(),$=x.current,O=window.getComputedStyle(se),P=(parseFloat(O.paddingTop)||0)+(parseFloat(O.paddingBottom)||0),z=W.offsetHeight+ee.offsetHeight+P+1,I=$!=null?Math.min(Math.max($,A()),H):Math.min(z,H);b(I)},[]);U.useLayoutEffect(M),U.useEffect(()=>{var ee;if(typeof ResizeObserver>"u")return;const W=new ResizeObserver(M),se=(ee=v.current)==null?void 0:ee.parentElement;return se&&W.observe(se),R.current&&W.observe(R.current),()=>W.disconnect()},[M]);const L=W=>{x.current=Math.round(Math.min(Math.max(W,A()),T())),M()},B=()=>{Vn({canvasInspectorHeight:x.current})},q=()=>{x.current=null,Vn({canvasInspectorHeight:null}),M()},F=W=>{if(W.button!==0)return;const se=W.currentTarget,ee=v.current;if(!ee)return;try{se.setPointerCapture(W.pointerId)}catch{}_(!0);const H=W.clientY,$=ee.getBoundingClientRect().height,O=z=>{L($+(H-z.clientY))},P=()=>{_(!1),B(),window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",P),window.removeEventListener("pointercancel",P)};window.addEventListener("pointermove",O),window.addEventListener("pointerup",P),window.addEventListener("pointercancel",P)},J=W=>{var ee;const se=((ee=v.current)==null?void 0:ee.getBoundingClientRect().height)??0;W.key==="ArrowUp"?(W.preventDefault(),L(se+_b),B()):W.key==="ArrowDown"?(W.preventDefault(),L(se-_b),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:F,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:Ww(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&&n?h.jsx(yT,{graph:n,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}),(te=e.badges)==null?void 0:te.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.")||(j(!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:n,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:n}),r&&h.jsx("span",{className:"empty-state-body",children:r}),o&&h.jsx("span",{className:"empty-state-cta",children:o}),l]})}function Vv(e){return e.replace(/^@[^/]+\//,"").replace(/^example-/,"").trim()||e}function wT(e,t=Date.now()){const n=Math.max(0,Math.round((t-e)/1e3));if(n<45)return"just now";const r=Math.round(n/60);if(r<60)return`${r}m ago`;const o=Math.round(r/60);return o<24?`${o}h ago`:`${Math.round(o/24)}d ago`}var nx=zw();function bo(e,{onDismiss:t,containerRef:n,triggerRef:r}){U.useEffect(()=>{if(!e)return;const o=f=>{var d;const l=n.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,n,r])}const ml=4,Ji=8;function xT(e,t,n,r,o){const c=e.getBoundingClientRect(),f={position:"fixed",top:"auto",right:"auto",bottom:"auto",left:"auto"};return o&&(f.overflowY="auto"),n&&(f.width=c.width),f.maxWidth=window.innerWidth-2*Ji,t.startsWith("right")?(f.left=(r??e).getBoundingClientRect().right+ml,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+ml,o&&(f.maxHeight=window.innerHeight-c.bottom-ml-Ji)):(f.bottom=window.innerHeight-c.top+ml,o&&(f.maxHeight=c.top-ml-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:n,placement:r,matchWidth:o=!1,besideRef:c,noClip:f=!1,className:l,role:d,testid:m,children:y}){const v=U.useRef(null),[S,w]=U.useState(null);bo(e,{onDismiss:n,containerRef:v,triggerRef:t});const R=U.useCallback(()=>{const x=t.current;x&&w(xT(x,r,o,(c==null?void 0:c.current)??null,!f))},[t,r,o,c,f]);return U.useLayoutEffect(()=>{e?R():w(null)},[e,R]),U.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]),U.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:nx.createPortal(h.jsx("div",{ref:v,className:l,role:d,"data-testid":m,style:S,children:y}),document.body)}function CT(e,t){return`${t?`${t} run`:"run"} ${e.status}`}function ET({workflow:e,detailStep:t,onBack:n,onAskAgent:r,surface:o,stepsSummary:c,run:f,runTarget:l,runs:d,onSelectRun:m}){const[y,v]=U.useState(!1),S=U.useRef(null),w=U.useCallback(()=>v(!1),[]),[R,x]=U.useState(!1),g=U.useRef(null),b=U.useCallback(()=>x(!1),[]);if(t)return h.jsxs("div",{className:"workflow-actions-header","data-testid":"workflow-actions-header",...Ft({object:"run"}),children:[h.jsx("button",{className:"theme-toggle","data-testid":"canvas-detail-back",onClick:n,"aria-label":"Back to the steps list","data-tooltip":"Back to the steps list",children: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:Ww(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"}),CT(f,l)]});return h.jsxs("div",{className:"workflow-actions-header"+(f?" has-run":""),"data-testid":"workflow-actions-header",...Ft({object:"agent"}),children:[h.jsx("span",{className:"workflow-actions-name",title:e.name,children:Vv(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 j=d.length-k,C=_.run.executionId===f.executionId,T=wT(_.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 ${j} · ${_.run.status} · ${_.target}`}),h.jsx("span",{className:"canvas-run-option-meta",children:T})]},_.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 kT(e){return e.map((t,n)=>({step:t,index:n})).sort((t,n)=>{const r=t.step.startedAt?Date.parse(t.step.startedAt):Number.NaN,o=n.step.startedAt?Date.parse(n.step.startedAt):Number.NaN;return Number.isFinite(r)&&Number.isFinite(o)&&r!==o?r-o:Number.isFinite(r)!==Number.isFinite(o)?Number.isFinite(r)?-1:1:t.index-n.index}).map(({step:t})=>t)}function jT(e){return e==="completed"?"Completed":e==="failed"?"Failed":e==="cancelled"?"Cancelled":"Running"}function AT(e){return e==="prod"?"Cloud":e==="local"?"Local":"Run"}function RT(e){if(e.startedAt&&e.finishedAt){const n=Date.parse(e.startedAt),r=Date.parse(e.finishedAt);if(Number.isFinite(n)&&Number.isFinite(r)&&r>=n)return r-n}const t=e.steps.reduce((n,r)=>n+(r.latencyMs??0),0);return t>0?t:null}function rx({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 TT(e,t){if(!e.startedAt||!t.startedAt)return{left:0,width:e.latencyMs?100:12};const n=Date.parse(t.startedAt),r=Date.parse(e.startedAt),o=t.finishedAt?Date.parse(t.finishedAt):Date.now(),c=e.finishedAt?Date.parse(e.finishedAt):o;return![n,r,o,c].every(Number.isFinite)||o<=n?{left:0,width:e.latencyMs?100:12}:{left:Math.max(0,Math.min(96,(r-n)/(o-n)*100)),width:Math.max(4,Math.min(100,(c-r)/(o-n)*100))}}function yb({attempts:e,run:t,selectedId:n,onSelect:r}){const o=U.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=TT(c,t);return h.jsxs("button",{ref:d=>{o.current[f]=d},type:"button",role:"option","aria-selected":n===c.id,tabIndex:n===c.id||n===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(rx,{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?Wn(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 NT(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 MT({step:e,tab:t}){var r,o;const n=NT(e,t);return n===void 0||t==="calls"&&Array.isArray(n)&&n.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(n)?h.jsx("div",{className:"run-call-list",children:n.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(Il,{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(Il,{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(Il,{value:n,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 OT(e,t){var r;const n=(r=t.logSlice)==null?void 0:r.slice(-4e3);return JSON.stringify({executionId:e.executionId,runStatus:e.status,runInput:e.input,runOutput:e.output,runError:e.error,attempt:{step:t.name,number:t.attempt??1,status:t.status,startedAt:t.startedAt,finishedAt:t.finishedAt,input:t.input,output:t.output,state:t.sharedState,directive:t.directive,calls:t.calls,error:t.error,logTail:n}},null,2)}function bb({run:e,step:t,tab:n,onTab:r,onBack:o,onAskAgent:c}){const f=U.useRef([]),l=U.useId(),d=`${l}-panel`;return h.jsxs("section",{className:"run-attempt-inspector","aria-label":`${t.name} attempt ${t.attempt??1}`,...Ft({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?` · ${Wn(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
|
-
${OT(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":n===m.id,"aria-controls":d,tabIndex:n===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}-${n}`,children:h.jsx(MT,{step:t,tab:n})})]})}function DT({run:e}){const t=e.unusedStubs??[],n=e.stubWarnings??[];return t.length===0&&n.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+n.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}`))})]}),n.length>0&&h.jsxs("section",{children:[h.jsx("h4",{children:"Warnings"}),h.jsx("ul",{children:n.map((r,o)=>h.jsx("li",{children:r},o))})]})]})}function $T(e){if(e.output!==void 0)return{value:e.output,label:"Result"};const t=[...e.steps].reverse().find(n=>n.status==="passed"&&n.output!==void 0);return t?{value:t.output,label:"Latest output"}:null}function Sb({run:e,target:t,workflow:n,focus:r,onToggleFocus:o,onAskAgent:c,onInspectionOpened:f,onArtifactViewed:l,onDashboardOpened:d}){const m=U.useMemo(()=>kT(e.steps),[e.steps]),[y,v]=U.useState(null),[S,w]=U.useState("output"),R=U.useRef(!1),x=U.useRef(null),g=U.useRef(null),b=U.useRef(null),p=m.find(A=>A.id===y)??null,_=$T(e),k=RT(e);U.useEffect(()=>{R.current=!1,x.current=null,v(null),w("output")},[e.executionId]),U.useEffect(()=>{if(!(R.current||e.status==="running"))if(e.status==="failed"){const A=[...m].reverse().find(M=>M.status==="failed");A&&(v(A.id),w("logs"))}else e.status==="completed"&&v(null)},[e.status,m]),U.useEffect(()=>{if(!r||typeof document>"u")return;const A=document.getElementById("root");g.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const M=(A==null?void 0:A.getAttribute("aria-hidden"))??null,L=(A==null?void 0:A.inert)??!1;A&&(A.inert=!0,A.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),A&&(A.inert=L,M===null?A.removeAttribute("aria-hidden"):A.setAttribute("aria-hidden",M)),(q=g.current)==null||q.focus(),g.current=null}},[r]),U.useEffect(()=>{if(!r)return;const A=M=>{M.key==="Escape"&&(M.preventDefault(),M.stopImmediatePropagation(),y!==null?v(null):o())};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[r,y,o]);const j=A=>{R.current=!0,v(A.id),w(A.status==="failed"?"logs":"output"),f==null||f()},C=h.jsxs("section",{className:"run-overview",children:[!r&&h.jsx(yb,{attempts:m,run:e,selectedId:y,onSelect:j}),_?h.jsx(Il,{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:Yw(e.error)})]}):h.jsx("div",{className:"run-result-pending",children:"No result was recorded."}),h.jsx(DT,{run:e})]}),T=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(rx,{status:e.status==="completed"?"passed":e.status==="failed"||e.status==="cancelled"?"failed":"running"}),jT(e.status)]}),k!==null&&h.jsx("span",{children:Wn(k)}),h.jsx("span",{children:AT(t)}),h.jsx("span",{className:"run-workspace-spacer"}),(n==null?void 0:n.definitionId)!=null&&h.jsxs("a",{href:yh(n.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(yb,{attempts:m,run:e,selectedId:y,onSelect:j}),h.jsx("div",{className:"run-workspace-inspector",children:p?h.jsx(bb,{run:e,step:p,tab:S,onTab:w,onBack:()=>v(null),onAskAgent:c}):C})]}):p?h.jsx(bb,{run:e,step:p,tab:S,onTab:w,onBack:()=>v(null),onAskAgent:c}):C]});return r&&typeof document<"u"?nx.createPortal(h.jsx("div",{className:"run-focus-layer","data-testid":"run-focus-layer",role:"dialog","aria-modal":"true","aria-label":"Execution Focus mode",children:T}),document.body):T}var me=typeof window<"u"?window:void 0,Js=typeof globalThis<"u"?globalThis:me,ii=Js==null?void 0:Js.navigator,Le=Js==null?void 0:Js.document,Cs=Js==null?void 0:Js.location,Wv=Js==null?void 0:Js.fetch,Um=Js!=null&&Js.XMLHttpRequest&&"withCredentials"in new Js.XMLHttpRequest?Js.XMLHttpRequest:void 0,wb=Js==null?void 0:Js.AbortController,LT=Js==null?void 0:Js.CompressionStream,pi=ii==null?void 0:ii.userAgent;function ax(){return!(!me||me.navigator.onLine===!1)}var vl=typeof globalThis<"u"?globalThis:me;vl&&typeof self>"u"&&(vl.self=vl),vl&&typeof File>"u"&&(vl.File=function(){});var Ue=me??{},Pt={DEBUG:!1,LIB_VERSION:"0.3.1",LIB_NAME:"browser-common"};function xb(e,t,n,r,o,c,f){try{var l=e[c](f),d=l.value}catch(m){return void n(m)}l.done?t(d):Promise.resolve(d).then(r,o)}function os(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var c=e.apply(t,n);function f(d){xb(c,r,o,f,l,"next",d)}function l(d){xb(c,r,o,f,l,"throw",d)}f(void 0)}))}}function je(){return je=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},je.apply(null,arguments)}function ox(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Cb=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function Eb(e){return typeof e=="string"||e}function kb(e){return typeof e=="string"?e:void 0}var gl,IT=["$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"],Bn=(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})({}),jb=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),PT=["$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"],BT=["token"],lx="NativeGzipValidationError",qm=e=>e.length>=2&&e[0]===31&&e[1]===139,Ab=(e,t)=>e===jb.GZipJS||t===jb.GZipJS||t==="gzip",Rb=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",gu=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=lx,t},HT=(function(){var e=os((function*(t,n){18>t.size&&gu("too-short");var r=new Uint8Array(yield t.slice(0,10).arrayBuffer());qm(r)&&r[2]===8||gu("invalid-header");var o=new DataView(yield t.slice(t.size-8).arrayBuffer());o.getUint32(0,!0)!==(f=>{for(var l=(()=>{if(gl)return gl;gl=[];for(var y=0;256>y;y++){for(var v=y,S=0;8>S;S++)v=1&v?3988292384^v>>>1:v>>>1;gl[y]=v>>>0}return gl})(),d=4294967295,m=0;f.length>m;m++)d=l[255&(d^f[m])]^d>>>8;return(4294967295^d)>>>0})(n)&&gu("invalid-crc");var c=n.length>>>0;o.getUint32(4,!0)!==c&&gu("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function Fm(){return Fm=os((function*(e,t,n){t===void 0&&(t=!0);try{var r=new TextEncoder().encode(e),o=new globalThis.CompressionStream("gzip"),c=o.writable.getWriter(),f=c.write(r).then((()=>c.close())).catch((function(){var m=os((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 HT(d,r),d}catch(m){if(n!=null&&n.rethrow)throw m;return t&&console.error("Failed to gzip compress data",m),null}})),Fm.apply(this,arguments)}var zT=["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"],Tb=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return zT.concat(t).some((r=>{var o=r.toLowerCase();return n.indexOf(o)!==-1}))};function Ye(e,t){return e.indexOf(t)!==-1}var bh=function(e){return e.trim()},Vm=function(e){return e.replace(/^\$/,"")};function cx(e){var t,n=[];return(t=JSON.stringify(e,(function(r,o){if(typeof o=="bigint")return o.toString();if(typeof o!="function"&&typeof o!="symbol"){if(o instanceof Error)return{name:o.name,message:o.message,stack:o.stack};if(o&&typeof o=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(o))return"[Circular]";n.push(o)}return o}})))!==null&&t!==void 0?t:"null"}var ux=Object.prototype,dx=ux.hasOwnProperty,Sh=ux.toString,nt=Array.isArray||function(e){return Sh.call(e)==="[object Array]"},Ai=e=>typeof e=="function",as=e=>e===Object(e)&&!nt(e),_r=e=>{if(as(e)){for(var t in e)if(dx.call(e,t))return!1;return!0}return!1},Te=e=>e===void 0,Yt=e=>Sh.call(e)=="[object String]",Wm=e=>Yt(e)&&e.trim().length===0,ni=e=>e===null,at=e=>Te(e)||ni(e),Ws=e=>Sh.call(e)=="[object Number]"&&e==e,In=e=>Ws(e)&&e>0,Qi=e=>Sh.call(e)==="[object Boolean]",UT=e=>e instanceof FormData,qT=e=>Ye(PT,e),FT=e=>Ye(BT,e);function hx(e){return e===null||typeof e!="object"}function Ud(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Gv(e){return typeof Event<"u"&&(function(t,n){try{return t instanceof n}catch{return!1}})(e,Event)}var VT=[!0,"true",1,"1","yes"],Up=e=>Ye(VT,e),WT=[!1,"false",0,"0","no"];function hn(e,t,n,r,o){return t>n&&(r.warn("min cannot be greater than max."),t=n),Ws(e)?e>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+o),hn(o||n,t,n,r))}class GT{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,n){var r=Math.floor((n-t.lastAccess)/this.st);r>0&&(t.tokens=Math.min(t.tokens+r*this.nt,this.rt),t.lastAccess=t.lastAccess+r*this.st)}consumeRateLimit(t){var n,r=Date.now(),o=String(t),c=this.tt[o];return c?this.ot(c,r):this.tt[o]=c={tokens:this.rt,lastAccess:r},c.tokens===0||(c.tokens--,c.tokens===0&&((n=this.et)==null||n.call(this,t)),c.tokens===0)}stop(){this.tt={}}}var Ni="Mobile",qd="iOS",Fn="Android",fo="Tablet",fx=Fn+" "+fo,px="iPad",mx="Apple",vx=mx+" Watch",Pl="Safari",po="BlackBerry",gx="Samsung",_x=gx+"Browser",yx=gx+" Internet",aa="Chrome",KT=aa+" OS",bx=aa+" "+qd,Kv="Internet Explorer",Sx=Kv+" "+Ni,Yv="Opera",YT=Yv+" Mini",Xv="Edge",wx="Microsoft "+Xv,oo="Firefox",xx=oo+" "+qd,Vl="Nintendo",Wl="PlayStation",lo="Xbox",Cx=Fn+" "+Ni,Ex=Ni+" "+Pl,Nl="Windows",Gm=Nl+" Phone",Nb="Nokia",Km="Ouya",kx="Generic",XT=kx+" "+Ni.toLowerCase(),jx=kx+" "+fo.toLowerCase(),Ym="Konqueror",Ax="Oculus Browser",Fd="Vivaldi",Rx="Yandex",Vd="Whale",Xm="DuckDuckGo",Tx="Pale Moon",Wd="Waterfox",Bl="Brave",Nx="Google Search App",ds="(\\d+(\\.\\d+)?)",qp=new RegExp("Version/"+ds),JT=new RegExp(lo,"i"),ZT=new RegExp(Wl+" \\w+","i"),QT=new RegExp(Vl+" \\w+","i"),Jv=new RegExp(po+"|PlayBook|BB10","i"),e3={"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"},Mx=function(e,t,n,r){t=t||"";var o=(function(c){return c!=null&&c.brave?Bl:null})(n);return o||(r!=null&&r.detectGoogleSearchApp&&Ye(e,"GSA/")?Nx:Ye(e," OPR/")&&Ye(e,"Mini")?YT:Ye(e," OPR/")?Yv:Jv.test(e)?po:Ye(e,"IE"+Ni)||Ye(e,"WPDesktop")?Sx:Ye(e,"OculusBrowser")?Ax:Ye(e,_x)?yx:Ye(e,Xv)||Ye(e,"Edg/")?wx:Ye(e,Fd+"/")?Fd:Ye(e,"YaBrowser/")?Rx:Ye(e,Vd+"/")?Vd:Ye(e,Xm+"/")||Ye(e,"Ddg/")?Xm:Ye(e,"FBIOS")?"Facebook "+Ni:Ye(e,"UCWEB")||Ye(e,"UCBrowser")?"UC Browser":Ye(e,"CriOS")?bx:Ye(e,"CrMo")||Ye(e,aa)?aa:Ye(e,Fn)&&Ye(e,Pl)?Cx:Ye(e,"FxiOS")?xx:Ye(e.toLowerCase(),Ym.toLowerCase())?Ym:Ye(e,Bl+"/")?Bl:((c,f)=>f&&Ye(f,mx)||(function(l){return Ye(l,Pl)&&!Ye(l,aa)&&!Ye(l,Fn)})(c))(e,t)?Ye(e,Ni)?Ex:Pl:Ye(e,"PaleMoon/")?Tx:Ye(e,Wd+"/")?Wd:Ye(e,oo)?oo:Ye(e,"MSIE")||Ye(e,"Trident/")?Kv:Ye(e,"Gecko")?oo:"")},t3={[Sx]:[new RegExp("rv:"+ds)],[wx]:[new RegExp(Xv+"?\\/"+ds)],[aa]:[new RegExp("("+aa+"|CrMo)\\/"+ds)],[bx]:[new RegExp("CriOS\\/"+ds)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ds)],[Pl]:[qp],[Ex]:[qp],[Yv]:[new RegExp("(Opera|OPR)\\/"+ds)],[oo]:[new RegExp(oo+"\\/"+ds)],[xx]:[new RegExp("FxiOS\\/"+ds)],[Ym]:[new RegExp("Konqueror[:/]?"+ds,"i")],[po]:[new RegExp(po+" "+ds),qp],[Cx]:[new RegExp("android\\s"+ds,"i")],[yx]:[new RegExp(_x+"\\/"+ds)],[Ax]:[new RegExp("OculusBrowser\\/"+ds)],[Fd]:[new RegExp(Fd+"\\/"+ds)],[Rx]:[new RegExp("YaBrowser\\/"+ds)],[Vd]:[new RegExp(Vd+"\\/"+ds)],[Bl]:[new RegExp(Bl+"\\/"+ds)],[Xm]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ds)],[Tx]:[new RegExp("PaleMoon\\/"+ds)],[Wd]:[new RegExp(Wd+"\\/"+ds)],[Nx]:[new RegExp("GSA\\/"+ds)],[Kv]:[new RegExp("(rv:|MSIE )"+ds)],Mozilla:[new RegExp("rv:"+ds)]},s3=function(e,t,n,r){var o=Mx(e,t,n,r),c=t3[o];if(Te(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},Mb=[[new RegExp(lo+"; "+lo+" (.*?)[);]","i"),e=>[lo,e&&e[1]||""]],[new RegExp(Vl,"i"),[Vl,""]],[new RegExp(Wl,"i"),[Wl,""]],[Jv,[po,""]],[new RegExp(Nl,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Gm,""];if(new RegExp(Ni).test(t)&&!/IEMobile\b/.test(t))return[Nl+" "+Ni,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=e3[n[1]]||"";return/arm/i.test(t)&&(r="RT"),[Nl,r]}return[Nl,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[qd,[e[3],e[4],e[5]||"0"].join(".")]:[qd,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Te(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Fn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Fn+")","i"),e=>e&&e[2]?[Fn,[e[2],e[3],e[4]||"0"].join(".")]:[Fn,""]],[/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/,[KT,""]],[/Linux|debian/i,["Linux",""]]],Ob=function(e){return QT.test(e)?Vl:ZT.test(e)?Wl:JT.test(e)?lo:new RegExp(Km,"i").test(e)?Km:new RegExp("("+Gm+"|WPDesktop)","i").test(e)?Gm:/iPad/.test(e)?px:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?vx:Jv.test(e)?po:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Nb,"i").test(e)?Nb:/(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(Ni).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)?Fn:fx:new RegExp("(pda|"+Ni+")","i").test(e)?XT:new RegExp(fo,"i").test(e)&&!new RegExp(fo+" pc","i").test(e)?jx:""},i3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Db(e,t){return typeof(n=e)=="string"&&i3.test(n)?e:t();var n}function Sr(e){return e&&e.split("#")[0]}function Td(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}var n3=e=>e instanceof Error,Ox={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}},r3=Ox.info;function Dx(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(nt(e))return{arrayValue:{values:e.map((t=>Dx(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function Gd(e){var t=[];for(var n in e){var r=e[n];ni(r)||Te(r)||t.push({key:n,value:Dx(r)})}return t}function a3(e,t){var n=Ox[e.level||"info"]||r3,r=n.text,o=n.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),at(t.sessionStartTimestamp)||(f.sessionStartTimestamp=String(t.sessionStartTimestamp)),at(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=je({},f,e.attributes||{}),d={timeUnixNano:c,observedTimeUnixNano:c,severityNumber:o,severityText:r,body:{stringValue:e.body},attributes:Gd(l)};return e.trace_id&&(d.traceId=e.trace_id),e.span_id&&(d.spanId=e.span_id),Te(e.trace_flags)||(d.flags=e.trace_flags),d}function $x(e,t,n){return je({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}function Lx(e,t,n,r){return{resourceLogs:[{resource:{attributes:Gd(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}let o3=class{constructor(e,t,n,r,o,c,f){var l;c===void 0&&(c=()=>Promise.resolve()),this._instance=e,this.Te=t,this.it=n,this.ut=r,this.ht=o,this.dt=c,this.ct=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 n={record:a3(t,this.ut())};this.ht((()=>this.Ot(n)))}}else this.it.info("Log was rejected in beforeSend function")}}Rt(e){var t=this.Te.beforeSend;if(!t)return e;var n=nt(t)?t:[t],r=e;for(var o of n)try{var c=o(r);if(!c)return this.it.info("Log was rejected in beforeSend function"),null;r=c}catch(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 os((function*(){if(!e._instance.isDisabled)return e.vt||(e.vt=e.Ft().finally((()=>{e.vt=null}))),e.vt}))()}Ft(){var e=this;return os((function*(){var t;e.Tt();var n=(t=e._instance.getPersistedProperty(Bn.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var r=n.length,o=0;n.length>0&&r>o;){var c,f;e.ft=0;var l=Math.min(n.length,e.Ct),d=n.slice(0,l),m=Lx(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),n=(f=e._instance.getPersistedProperty(Bn.LogsQueue))!==null&&f!==void 0?f:[],o+=d.length,y.kind==="fatal"))throw y.error}}))()}Lt(e){var t=this;return os((function*(){var n,r=Math.max(0,e-t.ft),o=(n=t._instance.getPersistedProperty(Bn.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(Bn.LogsQueue,o.slice(r)),yield t.dt()}))()}At(){return $x(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ot(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(Bn.LogsQueue))!==null&&t!==void 0?t:[];this.kt>n.length||(n.shift(),this.ft++,this.it.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(Bn.LogsQueue,n),this.xt>n.length?this.Dt():this.Et()}}Dt(e){e===void 0&&(e=this.St),this.Nt||(this.Nt=Td((()=>{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(Bn.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return os((function*(){t.Tt();var n=t.flush().catch((()=>{}));e!==void 0?yield Promise.race([n,new Promise((r=>Td(r,e)))]):yield n}))()}flushWithTimeout(e){var t=this;return os((function*(){var n=!1,r=t.flush(),o=new Promise((c=>Td((()=>{n=!0,c()}),e)));try{yield Promise.race([r,o])}finally{n&&r.catch((()=>{}))}}))()}Et(){this.flush().then((()=>{this.yt=0}),(e=>{this.yt++,this.it.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.jt()&&this.Dt(this.qt())}))}Tt(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}};var Fp=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function $b(e){return String(e)+"000000"}function Lb(e,t,n,r){var o="";return r&&(o=Object.keys(r).sort().map((c=>JSON.stringify(c)+":"+JSON.stringify(r[c]))).join(",")),e+"\0"+t+"\0"+(n??"")+"\0"+o}let l3=class{constructor(e,t,n){this._instance=e,this.Te=t,this.it=n,this.Bt=new Map,this.vt=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Vt=0}count(e,t,n){t===void 0&&(t=1),this.Wt({name:e,type:"count",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(e,t,n){this.Wt({name:e,type:"gauge",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(e,t,n){this.Wt({name:e,type:"histogram",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var e=this,t=this.vt,n=(function(){var o=os((function*(){t&&(yield t.catch((()=>{}))),yield e.Zt()}));return function(){return o.apply(this,arguments)}})(),r=n().finally((()=>{this.vt===r&&(this.vt=null)}));return this.vt=r,r}drainWindow(){if(this.Bt.size===0)return null;var e=this.Bt;return this.Bt=new Map,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Gt(e)}reset(){this.Vt++,this.Tt(),this.Bt=new Map,this.vt=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set}Wt(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.Rt(e);if(t!==null)if(t.name&&typeof t.name=="string")if(typeof t.value=="number"&&Number.isFinite(t.value))if(t.type==="count"&&0>t.value)this.it.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var n,r;try{n=t.attributes?je({},t.attributes):void 0,r=Lb(t.type,t.name,t.unit,n)}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:n,windowStartMs:Date.now()},this.Bt.set(r,o)}var c=this.Ut.get(t.name);c===void 0?this.Ut.set(t.name,t.type):c===t.type||this.zt.has(t.name)||(this.zt.add(t.name),this.it.warn("Metric name '"+t.name+"' is already used as a "+c+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.Jt(o,t.value),this.Dt()}else this.it.warn("Dropping metric '"+t.name+"': value must be a finite number");else this.it.warn("Dropping metric with empty name")}}Qt(){return this.Te.maxSeriesPerFlush>this.Bt.size||(this.Ht||(this.Ht=!0,this.it.warn("Metric series cap reached ("+this.Te.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Jt(e,t){var n;switch(e.type){case"count":e.total=((n=e.total)!==null&&n!==void 0?n:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Fp.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,Fp)]+=1}}Rt(e){var t=this.Te.beforeSend;if(!t)return e;var n=nt(t)?t:[t],r=e;for(var o of n)try{var c=o(r);if(!c)return this.it.info("Metric was rejected in beforeSend function"),null;r=c}catch(f){return this.it.error("Error in beforeSend function for metric:",f),null}return r}Dt(){this.Nt||(this.Nt=Td((()=>{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 os((function*(){if(e.Bt.size!==0){var t=e.Bt;e.Bt=new Map,e.Ht=!1,e.Ut=new Map,e.zt=new Set;var n=e.Vt,r=yield e._instance.Kt(e.Gt(t));if(n===e.Vt)switch(r.kind){case"ok":return;case"retry-later":return e.Yt(t),void e.Dt();case"too-large":return void e.it.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.it.error("Failed to send metrics batch:",r.error)}}}))()}Gt(e){return t=this.Xt(e),n=(function(c,f,l){return je({},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:Gd(n)},scopeMetrics:[{scope:{name:r,version:o},metrics:t}]}]};var t,n,r,o}Xt(e){var t=$b(Date.now()),n=new Map;for(var r of e.values()){var o,c=Lb(r.type,r.name,r.unit,void 0),f=n.get(c);f||(f=je({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:[]},n.set(c,f));var l=Gd((o=r.attributes)!==null&&o!==void 0?o:{}),d=$b(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:Fp})}return Array.from(n.values())}Yt(e){var t,n;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)+((n=c.total)!==null&&n!==void 0?n: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 _u,Ib,Vp;function c3(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return Vp&&n.length===Ib||(Ib=n.length,Vp=n.reduce(((r,o)=>{_u||(_u={});var c=_u[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,_u[o]=[m,y];break}}return r}),{})),Vp}}class u3{constructor(t,n,r){r===void 0&&(r=[]),this.coercers=t,this.stackParser=n,this.modifiers=r}buildFromUnknown(t,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},o=this.buildCoercingContext(r,n,0).apply(t),c=this.buildParsingContext(n),f=this.parseStacktrace(o,c);return{$exception_list:this.convertToExceptionList(f,r),$exception_level:"error"}}modifyFrames(t){var n=this;return os((function*(){for(var r of t)r.stacktrace&&r.stacktrace.frames&&nt(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return t}))()}coerceFallback(t){var n;return{type:"Error",value:"Unknown error",stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(t,n){var r,o;return t.cause!=null&&(r=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(o=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),je({},t,{cause:r,stack:o})}applyChunkIds(t,n){return t.map((r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r)))}applyCoercers(t,n){for(var r of this.coercers)if(r.match(t))return r.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return os((function*(){var r=t;for(var o of n.modifiers)r=yield o(r);return r}))()}convertToExceptionList(t,n){var r,o,c,f={type:t.type,value:t.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(o=n.handled)===null||o===void 0||o,synthetic:(c=t.synthetic)!==null&&c!==void 0&&c}};t.stack&&(f.stacktrace={type:"raw",frames:t.stack});var l=[f];return t.cause!=null&&l.push(...this.convertToExceptionList(t.cause,je({},n,{handled:!0}))),l}buildParsingContext(t){var n;return{chunkIdMap:c3(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,r){r===void 0&&(r=0);var o=(c,f)=>{if(4>=f){var l=this.buildCoercingContext(t,n,f);return this.applyCoercers(c,l)}};return je({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:t,apply:c=>o(c,r),next:c=>o(c,r+1)})}}var mo="?";function Jm(e,t,n,r,o){var c={platform:e,filename:t,function:n==="<anonymous>"?mo:n,in_app:!0};return Te(r)||(c.lineno=r),Te(o)||(c.colno=o),c}var Ix=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:mo,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},d3=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,h3=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,f3=/\((\S*)(?::(\d+))(?::(\d+))\)/,p3=(e,t)=>{var n=d3.exec(e);if(n)return Jm(t,n[1],mo,+n[2],+n[3]);var r=h3.exec(e);if(r){if(r[2]&&r[2].indexOf("eval")===0){var o=f3.exec(r[2]);o&&(r[2]=o[1],r[3]=o[2],r[4]=o[3])}var c=Ix(r[1]||mo,r[2]);return Jm(t,c[1],c[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},m3=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,v3=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,g3=(e,t)=>{var n=m3.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=v3.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var o=n[3],c=n[1]||mo,f=Ix(c,o);return Jm(t,o=f[1],c=f[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Pb=/\(error: (.*)\)/;class _3{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var r=Yt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:r?t.stack:void 0,cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var n=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?n+": "+t.message:n}isDOMException(t){return Ud(t,"DOMException")}isDOMError(t){return Ud(t,"DOMError")}}class y3{match(t){return(n=>n instanceof Error)(t)}coerce(t,n){return{type:this.getType(t),value:this.getMessage(t,n),stack:this.getStack(t),cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var r=t.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(t){return t.stacktrace||t.stack||void 0}}class b3{constructor(){}match(t){return Ud(t,"ErrorEvent")&&t.error!=null}coerce(t,n){var r;return n.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var S3=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class w3{match(t){return typeof t=="string"}coerce(t,n){var r,o=this.getInfos(t),c=o[0],f=o[1];return{type:c??"Error",value:f??t,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(t){var n="Error",r=t,o=t.match(S3);return o&&(n=o[1],r=o[2]),[n,r]}}var x3=["fatal","error","warning","log","info","debug"];function Px(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var o=n.slice(0,r).join(", ");if(t>=o.length)return r===n.length?o:o.length>t?o.slice(0,t)+"...":o}return""}class C3{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var r,o=this.getErrorPropertyFromObject(t);return o?n.apply(o):{type:this.getType(t),value:this.getValue(t),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Gv(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var r=this.getObjectClassName(t);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+Px(t)}isSeverityLevel(t){return Yt(t)&&!Wm(t)&&x3.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var r=t[n];if(n3(r))return r}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class E3{match(t){return Gv(t)}coerce(t,n){var r,o=t.constructor.name;return{type:o,value:o+" captured as exception with keys: "+Px(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class k3{match(t){return hx(t)}coerce(t,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class j3{match(t){return Ud(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Gv(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var r,o=this.getUnhandledRejectionReason(t);return hx(o)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(o),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(o)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var Kd="$message",Yd="$timestamp",A3=new Set([Kd,Yd]),Wp={enabled:!0,max_bytes:32768};function Xd(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Wp.enabled,max_bytes:T3(e.max_bytes,Wp.max_bytes)}:je({},Wp)}class R3{constructor(t){this.$e=[],this.ze=0,this.Te=Xd(t)}setConfig(t){this.Te=Xd(t),this.Ze()}add(t){var n=(function(o){var c;try{c=cx(o)}catch{return}try{var f=JSON.parse(c);if(!as(f))return;var l=f,d=l[Kd],m=l[Yd];return!Yt(d)||d.trim().length===0||!Yt(m)&&!Ws(m)?void 0:{step:l,json:c}}catch{return}})(t);if(n){var r=(function(o){if(typeof TextEncoder<"u")return new TextEncoder().encode(o).length;for(var c=encodeURIComponent(o),f=0,l=0;c.length>l;l++)c[l]==="%"?(f+=1,l+=2):f+=1;return f})(n.json);r>this.Te.max_bytes||(this.$e.push({step:n.step,bytes:r}),this.ze+=r,this.Ze())}}getAttachable(){return this.$e.map((t=>t.step))}clear(){this.$e=[],this.ze=0}size(){return this.$e.length}Ze(){for(;this.ze>this.Te.max_bytes&&this.$e.length>0;){var t=this.$e.shift();t&&(this.ze-=t.bytes)}}}function T3(e,t){if(!Ws(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var Bx=function(e,t){var n=(t===void 0?{}:t).debugEnabled,r={k(o){if(me&&(Pt.DEBUG||me.POSTHOG_DEBUG||n)&&!Te(me.console)&&me.console){for(var c=("__rrweb_original__"in me.console[o])?me.console[o].__rrweb_original__:me.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)=>Bx(e+" "+o,c)};return r},Ne=Bx("[PostHog.js]"),cs=Ne.createLogger,N3=cs("[ExternalScriptsLoader]"),Gp=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return N3.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=Le==null?void 0:Le.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:n()}:(d.addEventListener("load",(m=>{d.__posthog_loading_callback_fired=!0,n(void 0,m)})),d.onerror=m=>n(m),{v:void 0})}},f=0;r.length>f;f++)if(o=c())return o.v}var l=()=>{if(!Le)return n("document not found");var d=Le.createElement("script");if(d.type="text/javascript",d.crossOrigin="anonymous",d.src=t,d.onload=v=>{d.__posthog_loading_callback_fired=!0,n(void 0,v)},d.onerror=v=>n(v),e.config.prepare_external_dependency_script&&(d=e.config.prepare_external_dependency_script(d)),!d)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")Le.head.appendChild(d);else{var m,y=Le.querySelectorAll("body > script");y.length>0?(m=y[0].parentNode)==null||m.insertBefore(d,y[0]):Le.body.appendChild(d)}};Le!=null&&Le.body?l():Le==null||Le.addEventListener("DOMContentLoaded",l)};Ue.__PosthogExtensions__=Ue.__PosthogExtensions__||{},Ue.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var r;if(e.config.strict_script_versioning)r=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var o="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var c=3e5;o=o+"&t="+Math.floor(Date.now()/c)*c}r=e.requestRouter.endpointFor("assets",o)}Gp(e,r,n)}else{var f=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Gp(e,f,n)}},Ue.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);Gp(e,r,n)};Pt.DEBUG=!1,Pt.LIB_VERSION="1.409.5",Pt.LIB_NAME="web";var Hx="$people_distinct_id",Gl="$device_id",Kp="$device_model",Ml="__alias",Ol="__timers",Zm="$autocapture_disabled_server_side",Qm="$heatmaps_enabled_server_side",ev="$exception_capture_enabled_server_side",tv="$error_tracking_suppression_rules",sv="$error_tracking_capture_extension_exceptions",iv="$web_vitals_enabled_server_side",Zv="$dead_clicks_enabled_server_side",Qv="$product_tours_enabled_server_side",nv="$web_vitals_allowed_metrics",ra="$session_recording_remote_config",zx="$replay_sample_rate",Ux="$replay_override_sampling",qx="$replay_override_linked_flag",Fx="$replay_override_url_trigger",Vx="$replay_override_event_trigger",so="$sesid",eg="$session_is_sampled",na="$enabled_feature_flags",Nd="$active_feature_flags",Dl="$early_access_features",rv="$feature_flag_details",Md="$feature_flag_payloads",av="$feature_flag_request_id",Jd="$minimal_flag_called_events",Pn="$override_feature_flags",Qa="$override_feature_flag_payloads",ea="$stored_person_properties",ta="$stored_group_properties",ov="$surveys",Zd="$surveys_loaded_at",lv="$surveys_activated",Od="$surveys_activated_session",$l="ph_product_tours",Hl="$flag_call_reported",cv="$flag_call_reported_session_id",uv="$feature_flag_errors",Kl="$feature_flag_evaluated_at",Fi="$user_state",dv="$client_session_props",hv="$capture_rate_limit",fv="$initial_campaign_params",pv="$initial_referrer_info",Qd="$initial_person_info",eh="$epp",yu="$posthog_cookieless",Wx="$cookieless_mode",Gx="$sdk_debug_extensions_init_method",Kx="$sdk_debug_extensions_init_time_ms",Yx="$sdk_debug_recording_script_not_loaded",tg="PostHog loadExternalDependency extension not found.",sa="on_reject",zn="always",Fa="anonymous",qr="identified",mv="identified_only",th="visibilitychange",sh="beforeunload",eo="$pageview",Yp="$pageleave",Xp="$identify",Bb="$groupidentify";function bu(e,t){nt(e)&&e.forEach(t)}function Xt(e,t){if(!at(e))if(nt(e))e.forEach(t);else if(UT(e))e.forEach(((r,o)=>t(r,o)));else for(var n in e)dx.call(e,n)&&t(e[n],n)}var es=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];for(var o of n)for(var c in o)o[c]!==void 0&&(e[c]=o[c]);return e};function Dd(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var Hb=function(e){try{return e()}catch{return}},M3=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];return e.apply(this,n)}catch(o){Ne.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ne.critical(o)}}},sg=function(e){var t={};return Xt(e,(function(n,r){(Yt(n)&&n.length>0||Ws(n))&&(t[r]=n)})),t},O3=["herokuapp.com","vercel.app","netlify.app"];function D3(e){var t=e==null?void 0:e.hostname;if(!Yt(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of O3)if(n===r)return!1;return!0}function hs(e,t,n,r){var o=r??{},c=o.capture,f=o.passive;e==null||e.addEventListener(t,n,{capture:c!==void 0&&c,passive:f===void 0||f})}function Xx(e){return e.name==="ph_toolbar_internal"}var Jx=e=>{if(Le){try{for(var t=e+"=",n=Le.cookie.split(";").filter((c=>c.length)),r=0;n.length>r;r++){for(var o=n[r];o.charAt(0)==" ";)o=o.substring(1,o.length);if(o.indexOf(t)===0)return decodeURIComponent(o.substring(t.length,o.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Ws(e)&&isFinite(e)&&Math.floor(e)===e});class ih{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,o){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(o)||0>t||0>n||0>r||0>o||t>0xffffffffffff||n>4095||r>1073741823||o>4294967295)throw new RangeError("invalid field value");var c=new Uint8Array(16);return c[0]=t/Math.pow(2,40),c[1]=t/Math.pow(2,32),c[2]=t/Math.pow(2,24),c[3]=t/Math.pow(2,16),c[4]=t/256,c[5]=t,c[6]=112|n>>>8,c[7]=n,c[8]=128|r>>>24,c[9]=r>>>16,c[10]=r>>>8,c[11]=r,c[12]=o>>>24,c[13]=o>>>16,c[14]=o>>>8,c[15]=o,new ih(c)}toString(){for(var t="",n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new ih(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class $3{generate(){var t=this.generateOrAbort();if(!Te(t))return t;this.S=0;var n=this.generateOrAbort();if(Te(n))throw new Error("Could not generate UUID after timestamp reset");return n}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.C();else{if(this.S>=t+1e4)return;this.M++,this.M>4398046511103&&(this.S++,this.C())}return ih.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 L3}}var zb,Zx=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};me&&!Te(me.crypto)&&crypto.getRandomValues&&(Zx=e=>crypto.getRandomValues(e));class L3{nextUint32(){return this.R.length>this.O||(Zx(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var Hn=()=>I3().toString(),I3=()=>(zb||(zb=new $3)).generate(),_l="",P3=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Un={N:()=>!!Le,P(e){Ne.error("cookieStore error: "+e)},q:Jx,F(e){var t;try{t=JSON.parse(Un.q(e))||{}}catch{}return t},A(e,t,n,r,o){if(!Le)return!1;try{var c="",f="",l=(function(y,v){if(v){var S=(function(R,x){if(x===void 0&&(x=Le),_l)return _l;if(!x||["localhost","127.0.0.1"].includes(R))return"";for(var g=R.split("."),b=Math.min(g.length,8),p="dmn_chk_"+Hn();!_l&&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",_l=_)}return _l})(y);if(!S){var w=(R=>{var x=R.match(P3);return x?x[0]:""})(y);w!==S&&Ne.info("Warning: cookie subdomain discovery mismatch",w,S),S=w}return S?"; domain=."+S:""}return""})(Le.location.hostname,r);if(n){var d=new Date;d.setTime(d.getTime()+864e5*n),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&&Ne.warn("cookieStore warning: large cookie, len="+m.length),Le.cookie=m,!0}catch{return!1}},D(e,t){if(Le!=null&&Le.cookie)try{Un.A(e,"",-1,t)}catch{return}}},Jp=null,Qt={N(){if(!ni(Jp))return Jp;var e=!0;if(Te(me))e=!1;else try{var t="__mplssupport__";Qt.A(t,"xyz"),Qt.q(t)!=='"xyz"'&&(e=!1),Qt.D(t)}catch{e=!1}return e||Ne.error("localStorage unsupported; falling back to cookie store"),Jp=e,e},P(e){Ne.error("localStorage error: "+e)},q(e){try{return me==null?void 0:me.localStorage.getItem(e)}catch(t){Qt.P(t)}return null},F(e){try{return JSON.parse(Qt.q(e))||{}}catch{}return null},A(e,t){try{return me==null||me.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Qt.P(n)}return!1},D(e){try{me==null||me.localStorage.removeItem(e)}catch(t){Qt.P(t)}}},B3=[Gl,"distinct_id",so,eg,eh,Qd,Fi],Su={},H3={N:()=>!0,P(e){Ne.error("memoryStorage error: "+e)},q:e=>Su[e]||null,F:e=>Su[e]||null,A:(e,t)=>(Su[e]=t,!0),D(e){delete Su[e]}},Fr=null,Vs={N(){if(!ni(Fr))return Fr;if(Fr=!0,Te(me))Fr=!1;else try{var e="__support__";Vs.A(e,"xyz"),Vs.q(e)!=='"xyz"'&&(Fr=!1),Vs.D(e)}catch{Fr=!1}return Fr},P(e){Ne.error("sessionStorage error: ",e)},q(e){try{return me==null?void 0:me.sessionStorage.getItem(e)}catch(t){Vs.P(t)}return null},F(e){try{return JSON.parse(Vs.q(e))||null}catch{}return null},A(e,t){try{return me==null||me.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Vs.P(n)}return!1},D(e){try{me==null||me.sessionStorage.removeItem(e)}catch(t){Vs.P(t)}}};class z3{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===zn||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,n=t.token,r=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(r?r+n:"__ph_opt_in_out_"+n)}get Qe(){var t=this.Je.q(this.Ke);return Up(t)?1:Ye(WT,t)?0:-1}get Je(){var t=this.Te.opt_out_capturing_persistence_type,n=t==="localStorage"?Qt:Un;if(!this.Ye||this.Ye!==n){this.Ye=n;var r=t==="localStorage"?Un:Qt;r.q(this.Ke)&&(this.Ye.q(this.Ke)||this.optInOut(Up(r.q(this.Ke))),r.D(this.Ke,this.Te.cross_subdomain_cookie))}return this.Ye}Ge(){return!!this.Te.respect_dnt&&[ii==null?void 0:ii.doNotTrack,ii==null?void 0:ii.msDoNotTrack,Ue.doNotTrack].some((t=>Up(t)))}}function Qx(e,t){var n,r=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!Ai(r))return t;try{var o=r(t);return Yt(o)&&o?o:t}catch(c){return Ne.error("Error in get_current_url, falling back to window.location.href",c),t}}var eC="__POSTHOG_TOOLBAR__",U3=1,q3=3,F3=11;function Ub(e){return e instanceof Element&&(e.id===eC||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function wr(e){return!!e&&e.nodeType===U3}function Ri(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function tC(e){return!!e&&e.nodeType===q3}function sC(e){return!!e&&e.nodeType===F3&&wr(e.host)}var iC=1e3;function ig(e){return e?bh(e).split(/\s+/):[]}function qb(e,t){var n=(function(r){var o,c=me==null||(o=me.location)==null?void 0:o.href;return Te(c)?void 0:Qx(r,c)})(t);return!!(n&&e&&e.some((r=>n.match(r))))}function nh(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 ig(t)}function nC(e){return at(e)?null:bh(e).split(/(\s+)/).filter((t=>zl(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Yl(e){var t="";return gv(e)&&!lC(e)&&e.childNodes&&e.childNodes.length&&Xt(e.childNodes,(function(n){var r;tC(n)&&n.textContent&&(t+=(r=nC(n.textContent))!==null&&r!==void 0?r:"")})),bh(t)}function Zp(e){var t;return Te(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var ng=["a","button","form","input","select","textarea","label"];function vv(e,t){if(Te(t))return!0;var n,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(n=r(o))return n.v;return!1}function rC(e){var t=e.parentNode;return!(!t||!wr(t))&&t}var V3=[".ph-no-autocapture","[data-ph-no-autocapture]"],aC=["next","previous","prev",">","<"],W3=[...aC,"+","-","−","–"],Fb=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Vb=[".ph-no-rageclick",".ph-no-capture"],G3=["","text","search","email","password","url","tel","number"];function Wb(e,t){if(!me||rg(e))return!1;var n,r,o,c,f;if(Qi(t)?(n=!!t&&Vb,r=void 0,o=!1):(n=(c=t==null?void 0:t.css_selector_ignorelist)!==null&&c!==void 0?c:Vb,r=t==null?void 0:t.content_ignorelist,o=(f=t==null?void 0:t.ignore_text_selection)!==null&&f!==void 0&&f),n===!1||o&&(function(d){return!(!d||!wr(d))&&(!!Ri(d,"textarea")||(Ri(d,"input")?Ye(G3,(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=oC(e,!1).targetElementList;return!(function(d,m){if(d===!1||Te(d))return!1;var y;if(d===!0)y=aC;else{if(!nt(d))return!1;if(d.length>10)return Ne.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=>Fb(S,R)||Fb(w,R)))}))})(r,l.map((d=>{var m;return{safeText:Yl(d).toLowerCase(),ariaLabel:((m=d.getAttribute("aria-label"))==null?void 0:m.toLowerCase().trim())||""}})))&&!vv(l,n)}var rg=e=>!e||Ri(e,"html")||!wr(e),oC=(e,t)=>{if(!me||rg(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],o=e;o.parentNode&&!Ri(o,"body");)if(sC(o.parentNode))r.push(o.parentNode.host),o=o.parentNode.host;else{var c=rC(o);if(!c)break;if(t||ng.indexOf(c.tagName.toLowerCase())>-1)n=!0;else try{var f=me.getComputedStyle(c);f&&f.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}r.push(c),o=c}return{parentIsUsefulElement:n,targetElementList:r}};function gv(e){for(var t=new Set,n=0,r=e;r.parentNode&&!Ri(r,"body");r=r.parentNode){if(n++>=iC||t.has(r))return!1;t.add(r);var o=nh(r);if(Ye(o,"ph-sensitive")||Ye(o,"ph-no-capture"))return!1}if(Ye(nh(e),"ph-include"))return!0;var c=e.type||"";if(Yt(c))switch(c.toLowerCase()){case"hidden":case"password":return!1}var f=e.name||e.id||"";return!Yt(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 lC(e){return!!(Ri(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Ri(e,"select")||Ri(e,"textarea")||e.getAttribute("contenteditable")==="true")}var Gb=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}))$"),Kb=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,K3=[16,15,14,13],Y3=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Yb=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Xb=/[0-9A-Za-z_]/;function X3(e){for(var t=0,n=!1,r=e.length-1;r>=0;r--){var o=e.charCodeAt(r)-48;n&&(o*=2)>9&&(o-=9),t+=o,n=!n}return t%10==0}function zl(e,t){if(t===void 0&&(t=!0),at(e))return!1;if(Yt(e)){e=bh(e);var n=t?Gb.test((e||"").replace(/[- ]/g,"")):(function(o){var c;for(Kb.lastIndex=0;c=Kb.exec(o);){var f=c[2];if(f)for(var l=f.replace(/[- ]/g,""),d=0;l.length>d;d++)for(var m of K3){var y=d+m;if(l.length>=y){var v=l.slice(d,y);if(Gb.test(v)&&X3(v))return!0}}}return!1})(e);if(n)return!1;var r=t?Y3.test(e):(function(o){var c;for(Yb.lastIndex=0;c=Yb.exec(o);){var f=c[1],l=c[3];if(!(f&&l&&Xb.test(f)&&Xb.test(l)))return!0}return!1})(e);if(r)return!1}return!0}function Jb(e){var t=Yl(e);return zl(t=(t+" "+cC(e)).trim())?t:""}function cC(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Xt(e.childNodes,(function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var o=Yl(n);t=(t+" "+o).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+cC(n)).trim())}catch(c){Ne.error("[AutoCapture]",c)}})),t}function Zb(e){return e.replace(/"|\\"/g,'\\"')}function J3(e){var t=e.attr__class;if(t)return nt(t)?t:ig(t)}var wu=cs("[Dead Clicks]"),Z3=()=>!0,Q3=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(Zv)),r=e.instance.config.capture_dead_clicks;return Qi(r)?r:!!as(r)||n};class Qb{get lazyLoadedDeadClicksAutocapture(){return this.Xe}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var n=t.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[Zv]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.tr((()=>{this.er()})):this.stop()}tr(t){var n,r;(n=Ue.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(r=Ue.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(o=>{o?wu.error("failed to load script",o):t()}))}er(){var t;if(Le){if(!this.Xe&&(t=Ue.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=as(this.instance.config.capture_dead_clicks)?je({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Xe=Ue.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Xe.start(Le),wu.info("starting...")}}else wu.error("`document` not found. Cannot start.")}stop(){this.Xe&&(this.Xe.stop(),this.Xe=void 0,wu.info("stopping..."))}}var Qp=cs("[SegmentIntegration]"),uC="posthog-js";function dC(e,t){var n=t===void 0?{}:t,r=n.organization,o=n.projectId,c=n.prefix,f=n.severityAllowList,l=f===void 0?["error"]:f,d=n.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((j=>je({},j,{stacktrace:j.stacktrace?je({},j.stacktrace,{type:"raw",frames:(j.stacktrace.frames||[]).map((C=>je({},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 eN{constructor(t,n,r,o,c,f){this.name=uC,this.setupOnce=function(l){l(dC(t,{organization:n,projectId:r,prefix:o,severityAllowList:c,sendExceptionsToPostHog:f==null||f}))}}}class e1{constructor(t){this.rr=(n,r,o)=>{o&&(o.noSessionId||o.activityTimeout||o.sessionPastMaximumLength||o.crossTabAdoption)&&(Ne.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:o}),this.ir=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.nr()}nr(){var t;this.sr=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.rr)}destroy(){var t;(t=this.sr)==null||t.call(this),this.sr=void 0}doPageView(t,n){var r,o=this.ar(t,n);return this.ir={pathname:(r=me==null?void 0:me.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),o}doPageLeave(t){var n;return this.ar(t,(n=this.ir)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.ir)==null?void 0:t.pageViewId}}ar(t,n){var r=this.ir;if(!r)return{$pageview_id:n};var o={$pageview_id:n,$prev_pageview_id:r.pageViewId},c=this._instance.scrollManager.getContext();if(c&&!this._instance.config.disable_scroll_properties){var f=c.maxScrollHeight,l=c.lastScrollY,d=c.maxScrollY,m=c.maxContentHeight,y=c.lastContentY,v=c.maxContentY;if(!(Te(f)||Te(l)||Te(d)||Te(m)||Te(y)||Te(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,Ne):1,w=f>1?hn(d/f,0,1,Ne):1,R=m>1?hn(y/m,0,1,Ne):1,x=m>1?hn(v/m,0,1,Ne):1;o=es(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 em=["flags","surveys"],tN={[Hx]:{exposure:"hidden"},[Ml]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Ol]:{exposure:"hidden"},[Zm]:{exposure:"event"},[Qm]:{exposure:"hidden"},[ev]:{exposure:"event"},[tv]:{exposure:"hidden"},[sv]:{exposure:"event"},[iv]:{exposure:"event"},[Zv]:{exposure:"event"},[Qv]:{exposure:"hidden"},[nv]:{exposure:"event"},[ra]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[so]:{exposure:"hidden"},[eg]:{exposure:"event"},[zx]:{exposure:"event",shouldSkipFromEventProperties:e=>ni(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(!as(e))return{};for(var t={},n=Object.keys(e),r=0;n.length>r;r++)t["$feature/"+n[r]]=e[n[r]];return t}},[Nd]:{exposure:"event",storageGroup:"flags"},[Dl]:{exposure:"hidden"},[rv]:{exposure:"hidden",storageGroup:"flags"},[Md]:{exposure:"event",storageGroup:"flags"},[av]:{exposure:"event",storageGroup:"flags",volatile:!0},[Jd]:{exposure:"hidden",storageGroup:"flags"},[Pn]:{exposure:"event"},[Qa]:{exposure:"hidden"},[ea]:{exposure:"hidden"},[ta]:{exposure:"hidden"},[ov]:{exposure:"hidden",storageGroup:"surveys"},[Zd]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[lv]:{exposure:"event"},[Od]:{exposure:"hidden"},[$l]:{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"},[Hl]:{exposure:"hidden"},[cv]:{exposure:"hidden"},[uv]:{exposure:"hidden"},[Kl]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Fi]:{exposure:"hidden"},[dv]:{exposure:"hidden"},[hv]:{exposure:"hidden"},[fv]:{exposure:"hidden"},[pv]:{exposure:"hidden"},[Qd]:{exposure:"hidden"},[eh]:{exposure:"hidden"},[Ux]:{exposure:"event"},[qx]:{exposure:"event"},[Fx]:{exposure:"event"},[Vx]:{exposure:"event"},[Gx]:{exposure:"event"},[Kx]:{exposure:"event"},[Yx]:{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"}},sN=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Vr=e=>{var t=tN[e];if(t)return t;for(var n of sN){var r=n[1];if(e.indexOf(n[0])===0)return r}},io=(e,t)=>{try{return JSON.stringify(e,((n,r)=>typeof r=="bigint"?r.toString():r),t)}catch{return cx(e)}},rh=e=>{var t=Le==null?void 0:Le.createElement("a");return Te(t)?null:(t.href=e,t)},vo=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),o=0;r.length>o;o++){var c=r[o].split("=");if(c[0]===t){n=c;break}}if(!nt(n)||2>n.length)return"";var f=n[1];try{f=decodeURIComponent(f)}catch{Ne.error("Skipping decoding for malformed query param: "+f)}return f.replace(/\+/g," ")},Xl=function(e,t,n){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("=");nt(v)&&(t.includes(v[0])?m.push(v[0]+"="+n):m.push(d[y]))}var S=l;return f!=null&&(S+="?"+m.join("&")),o!=null&&(S+="#"+o),S},ah=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},hC=(e,t)=>e>=t&&ax(),fC=(e,t,n,r)=>{if(e===0){if(ax()){var o=t+1;return o===n&&r(),o}return t}return 0},xu="https?://(.*)",go=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],iN=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...go],Jl="<masked>",nN=["li_fat_id"];function pC(e,t,n){if(!Le)return{};var r,o=t?[...go,...n||[]]:[],c=mC(Xl(Le.URL,o,Jl),e),f=(r={},Xt(nN,(function(l){var d=Jx(l);r[l]=d||null})),r);return es(f,c)}function mC(e,t){var n=iN.concat(t||[]),r={};return Xt(n,(function(o){var c=vo(e,o);r[o]=c||null})),r}function vC(e){var t=(function(c){return c?c.search(xu+"google.([^/?]*)")===0?"google":c.search(xu+"bing.com")===0?"bing":c.search(xu+"yahoo.com")===0?"yahoo":c.search(xu+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",r={};if(!ni(t)){r.$search_engine=t;var o=Le?vo(Le.referrer,n):"";o.length&&(r.ph_keyword=o)}return r}function t1(){return navigator.language||navigator.userLanguage}var oh="$direct";function gC(){return(Le==null?void 0:Le.referrer)||oh}function _C(e,t,n){n===void 0&&(n=!1);var r=e?[...go,...t||[]]:[],o=n?Sr(Cs==null?void 0:Cs.href):Cs==null?void 0:Cs.href,c=o==null?void 0:o.substring(0,1e3);return{r:gC().substring(0,1e3),u:c?Xl(c,r,Jl):void 0}}function yC(e,t){var n;t===void 0&&(t=!1);var r=e.r,o=e.u,c=t?Sr(o):o,f={$referrer:r,$referring_domain:r==null?void 0:r==oh?oh:(n=rh(r))==null?void 0:n.host};if(c){f.$current_url=c;var l=rh(c);f.$host=l==null?void 0:l.host,f.$pathname=l==null?void 0:l.pathname;var d=mC(c);es(f,d)}if(r){var m=vC(r);es(f,m)}return f}function bC(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function rN(){try{return new Date().getTimezoneOffset()}catch{return}}var aN={flags:Kl,surveys:Zd},oN=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Va="main";class tm{constructor(t,n,r){if(r===void 0&&(r=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=t,this.dr=r,this.props={},this.cr=void 0,this.vr=(c=>{var 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&&Ne.info("Persistence loaded",t.persistence,je({},this.props)),this.update_config(t,t,n),this.save(),me){var o=()=>this.flush();hs(me,"beforeunload",o,{capture:!1}),hs(me,"pagehide",o,{capture:!1})}}mr(){var t,n=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return Ws(n)&&n>0?n:0}isDisabled(){return!!this.yr}pr(t){oN.indexOf(t.persistence.toLowerCase())===-1&&(Ne.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,r=(function(f,l){f===void 0&&(f=[]),l===void 0&&(l=!1);var d=[...B3,...f];return je({},Qt,{F(m){try{var y={};try{y=Un.F(m)||{}}catch{}var v,S=JSON.parse(Qt.q(m)||"{}");if(l){var w={};for(var R in y){var x=y[R];ni(x)||x===""||(w[R]=x)}v=es(S,w)}else v=es(y,S);return Qt.A(m,v),v}catch{}return null},A(m,y,v,S,w,R){var x=Qt.A(m,y,void 0,void 0,R);try{var g={};d.forEach((b=>{y[b]&&(g[b]=y[b])})),Object.keys(g).length&&Un.A(m,g,v,S,w,R)}catch(b){Qt.P(b)}return x},D(m,y){try{me==null||me.localStorage.removeItem(m),Un.D(m,y)}catch(v){Qt.P(v)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),o=!1,c=t.persistence.toLowerCase();return c==="localstorage"&&Qt.N()?(n=Qt,o=!0):c==="localstorage+cookie"&&r.N()?(n=r,o=!0):c==="sessionstorage"&&Vs.N()?n=Vs:c==="memory"?n=H3:c==="cookie"?n=Un:r.N()?(n=r,o=!0):n=Un,this.ur=o,n}br(t){return this.vr+"__"+t}gr(t){return this.ur&&!!t.split_storage}_r(t){var n=t??this.Te.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var r=this.props[Kl];return!r||typeof r!="number"||Date.now()-r>n}properties(){var t={};return Xt(this.props,((n,r)=>{var o=Vr(r);if((o==null?void 0:o.exposure)==="derived"){if(o.shouldSkipFromEventProperties!=null&&o.shouldSkipFromEventProperties(n,r===na?()=>this._r():()=>!1))return;o.transformToEventProperties&&es(t,o.transformToEventProperties(n))}else if(!o||o.exposure==="event"){if(o!=null&&o.shouldSkipFromEventProperties!=null&&o.shouldSkipFromEventProperties(n,(()=>!1)))return;t[r]=n}})),t}load(){if(!this.yr){var t=this.Je.F(this.vr);t&&(this.props=es({},t)),this.hr&&this.wr()}}wr(){for(var t of em){var n=Qt.F(this.br(t));if(n&&!_r(n)){var r=this.kr(t);r.persisted=!0,this.Sr(t)||(r.fingerprint=this.Cr(n,t)),this.Mr(t,n)||es(this.props,n)}}}Sr(t){return Object.keys(this.props).some((n=>{var r;return((r=Vr(n))==null?void 0:r.storageGroup)===t}))}Mr(t,n){var r=aN[t];if(!r)return!1;var o=n[r],c=this.props[r];return Ws(o)&&Ws(c)&&c>o}refreshKey(t){var n;if(!this.yr){var r=this.hr?(n=Vr(t))==null?void 0:n.storageGroup:void 0,o=r?Qt.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?Te(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),t)):this.Rr()}}flush(){Te(this.Er)||(clearTimeout(this.Er),this.Er=void 0,this.Rr())}Rr(){this.yr||(this.hr?this.Pr():this.Or(this.Je,this.vr,this.props,Va))}Pr(){var t=this.Fr(),n=t.main,r=t.groups;for(var o of(this.Or(this.Je,this.vr,n,Va),em)){var c,f=r[o];(!_r(f)||(c=this.lr[o])!=null&&c.persisted)&&this.Or(Qt,this.br(o),f,o)}}Fr(){var t={},n={flags:{},surveys:{}};return Xt(this.props,((r,o)=>{var c,f=(c=Vr(o))==null?void 0:c.storageGroup;f?n[f][o]=r:t[o]=r})),{main:t,groups:n}}Cr(t,n){if(n===Va)return JSON.stringify(t)+"|"+this.Ar+"|"+this.$r+"|"+this.Lr;var r={};return Xt(t,((o,c)=>{var f;r[c]=(f=Vr(c))!=null&&f.volatile?"__volatile__":o})),JSON.stringify(r)}Or(t,n,r,o){var c=this.kr(o);if(o===Va||c.dirty||Te(c.fingerprint)){var f;try{if((f=this.Cr(r,o))===c.fingerprint)return void(c.dirty=!1)}catch{f=void 0}t.A(n,r,this.Ar,this.$r,this.Lr,this.Te.debug)?(c.dirty=!1,o!==Va&&(c.persisted=!0),Te(f)||(c.fingerprint=f)):this.Te.debug&&Ne.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(t){var n=(t===void 0?{}:t).keepGroupEntries,r=n!==void 0&&n;if(Te(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Je.D(this.vr,!1),this.Je.D(this.vr,!0),!r&&this.dr)for(var o of em)Qt.D(this.br(o));r?delete this.lr[Va]:this.lr={}}clear(){this.remove(),this.props={}}register_once(t,n,r){if(as(t)){Te(n)&&(n="None"),this.Ar=Te(r)?this.Dr:r;var o=!1;if(Xt(t,((c,f)=>{this.props.hasOwnProperty(f)&&this.props[f]!==n||(this.Ir(f,c),o=!0)})),o)return this.save(),!0}return!1}register(t,n){if(as(t)){this.Ar=Te(n)?this.Dr:n;var r=!1;if(Xt(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=Le==null?void 0:Le.URL;if(t!==this.cr){var n=pC(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);_r(sg(n))||this.register(n),this.cr=t}}update_search_keyword(){var t;this.register((t=Le==null?void 0:Le.referrer)?vC(t):{})}update_referrer_info(){var t;this.register_once({$referrer:gC(),$referring_domain:Le!=null&&Le.referrer&&((t=rh(Le.referrer))==null?void 0:t.host)||oh},void 0)}set_initial_person_info(){this.props[fv]||this.props[pv]||this.register_once({[Qd]:_C(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={};Xt([pv,fv],(o=>{var c=this.props[o];c&&Xt(c,(function(f,l){t["$initial_"+Vm(l)]=f}))}));var n=this.props[Qd];if(n){var r=(function(o,c){c===void 0&&(c=!1);var f=yC(o,c),l={};return Xt(f,(function(d,m){l["$initial_"+Vm(m)]=d})),l})(n,this.Te.disable_capture_url_hashes);es(t,r)}return t}safe_merge(t){return Xt(this.props,(function(n,r){r in t||(t[r]=n)})),t}update_config(t,n,r){this.Dr=this.Ar=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!r),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var o=t.persistence!==n.persistence||!((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||[],n.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,n){var r=this.props[Ol]||{};r[t]=n,this.Ir(Ol,r),this.save()}remove_event_timer(t){var n=this.props[Ol]||{},r=n[t];return Te(r)||(delete n[t],this.Ir(Ol,n),this.save()),r}get_property(t){return this.props[t]}set_property(t,n){this.Ir(t,n),this.save()}Ir(t,n){var r;this.props[t]=n,(r=Vr(t))!=null&&r.volatile||this.Nr(t)}Tr(t){delete this.props[t],this.Nr(t)}Nr(t){var n,r=(n=Vr(t))==null?void 0:n.storageGroup;r&&(this.kr(r).dirty=!0)}kr(t){return this.lr[t]||(this.lr[t]={})}}function Cu(e){var t=!0;return{dispose(){if(t){t=!1;var n=e();n&&Ai(n.then)&&n.then(void 0,(()=>{}))}}}}var si={GZipJS:"gzip-js",Base64:"base64"},yl={Activation:"events",Cancellation:"cancelEvents"},sm={Popover:"popover",API:"api",Widget:"widget"},qn={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},im={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},_v={Popover:"popover",Inline:"inline"},lN={SHOWN:"product tour shown"},s1={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},i1=cs("[RateLimiter]");class cN{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((o=>{i1.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4}))}catch(o){return void i1.warn('could not rate limit - continuing. Error: "'+(o==null?void 0:o.message)+'"',{text:r})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)==null?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)==null?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var n,r,o;t===void 0&&(t=!1);var c=this.captureEventsBurstLimit,f=this.captureEventsPerSecond,l=new Date().getTime(),d=(n=(r=this.instance.persistence)==null?void 0:r.get_property(hv))!==null&&n!==void 0?n:{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(hv,d),{isRateLimited:m,remainingTokens:d.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Wr=cs("[RemoteConfig]");class SC{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Ue._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}qr(t){var n,r;(n=Ue.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=Ue.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}jr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){t(n.json)}})}load(){try{if(this.remoteConfig)return 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((n=>{this.Br(n),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()&&Le&&Le.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Hr(){var t;if(!this.zr){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.zr=setInterval((()=>{this.refresh()}),n))}}Br(t){t||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 n;(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded()}catch(r){Wr.error("Error loading feature flags",r)}}}var Wi=Uint8Array,mi=Uint16Array,_o=Uint32Array,ag=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]),og=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]),n1=new Wi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),wC=function(e,t){for(var n=new mi(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var o=new _o(n[30]);for(r=1;30>r;++r)for(var c=n[r];n[r+1]>c;++c)o[c]=c-n[r]<<5|r;return[n,o]},xC=wC(ag,2),yv=xC[1];xC[0][28]=258,yv[258]=28;for(var r1=wC(og,0)[1],CC=new mi(32768),ls=0;32768>ls;++ls){var Wa=(43690&ls)>>>1|(21845&ls)<<1;CC[ls]=((65280&(Wa=(61680&(Wa=(52428&Wa)>>>2|(13107&Wa)<<2))>>>4|(3855&Wa)<<4))>>>8|(255&Wa)<<8)>>>1}var Ul=function(e,t,n){for(var r=e.length,o=0,c=new mi(t);r>o;++o)++c[e[o]-1];var f,l=new mi(t);for(o=0;t>o;++o)l[o]=l[o-1]+c[o-1]<<1;for(f=new mi(r),o=0;r>o;++o)f[o]=CC[l[e[o]-1]++]>>>15-e[o];return f},oa=new Wi(288);for(ls=0;144>ls;++ls)oa[ls]=8;for(ls=144;256>ls;++ls)oa[ls]=9;for(ls=256;280>ls;++ls)oa[ls]=7;for(ls=280;288>ls;++ls)oa[ls]=8;var lh=new Wi(32);for(ls=0;32>ls;++ls)lh[ls]=5;var uN=Ul(oa,9),dN=Ul(lh,5),EC=function(e){return(e/8>>0)+(7&e&&1)},kC=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof mi?mi:e instanceof _o?_o:Wi)(n-t);return r.set(e.subarray(t,n)),r},Mn=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},bl=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},nm=function(e,t){for(var n=[],r=0;e.length>r;++r)e[r]&&n.push({s:r,f:e[r]});var o=n.length,c=n.slice();if(!o)return[new Wi(0),0];if(o==1){var f=new Wi(n[0].s+1);return f[n[0].s]=1,[f,1]}n.sort((function(j,C){return j.f-C.f})),n.push({s:-1,f:25001});var l=n[0],d=n[1],m=0,y=1,v=2;for(n[0]={s:-1,f:l.f+d.f,l,r:d};y!=o-1;)l=n[n[v].f>n[m].f?m++:v++],d=n[m!=y&&n[v].f>n[m].f?m++:v++],n[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 mi(S+1),R=bv(n[y-1],w,0);if(R>t){r=0;var x=0,g=R-t,b=1<<g;for(c.sort((function(j,C){return w[C.s]-w[j.s]||j.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]},bv=function(e,t,n){return e.s==-1?Math.max(bv(e.l,t,n+1),bv(e.r,t,n+1)):t[e.s]=n},a1=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new mi(++t),r=0,o=e[0],c=1,f=function(d){n[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[n.subarray(0,r),t]},Sl=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},Sv=function(e,t,n){var r=n.length,o=EC(t+2);e[o]=255&r,e[o+1]=r>>>8,e[o+2]=255^e[o],e[o+3]=255^e[o+1];for(var c=0;r>c;++c)e[o+c+4]=n[c];return 8*(o+4+r)},o1=function(e,t,n,r,o,c,f,l,d,m,y){Mn(t,y++,n),++o[256];for(var v=nm(o,15),S=v[0],w=v[1],R=nm(c,15),x=R[0],g=R[1],b=a1(S),p=b[0],_=b[1],k=a1(x),j=k[0],C=k[1],T=new mi(19),A=0;p.length>A;++A)T[31&p[A]]++;for(A=0;j.length>A;++A)T[31&j[A]]++;for(var M=nm(T,7),L=M[0],B=M[1],q=19;q>4&&!L[n1[q-1]];--q);var F,J,te,W,se=m+5<<3,ee=Sl(o,oa)+Sl(c,lh)+f,H=Sl(o,S)+Sl(c,x)+f+14+3*q+Sl(T,L)+(2*T[16]+3*T[17]+7*T[18]);if(ee>=se&&H>=se)return Sv(t,y,e.subarray(d,d+m));if(Mn(t,y,1+(ee>H)),y+=2,ee>H){F=Ul(S,w),J=S,te=Ul(x,g),W=x;var $=Ul(L,B);for(Mn(t,y,_-257),Mn(t,y+5,C-1),Mn(t,y+10,q-4),y+=14,A=0;q>A;++A)Mn(t,y+3*A,L[n1[A]]);y+=3*q;for(var O=[p,j],P=0;2>P;++P){var z=O[P];for(A=0;z.length>A;++A)Mn(t,y,$[I=31&z[A]]),y+=L[I],I>15&&(Mn(t,y,z[A]>>>5&127),y+=z[A]>>>12)}}else F=uN,J=oa,te=dN,W=lh;for(A=0;l>A;++A)if(r[A]>255){var I;bl(t,y,F[257+(I=r[A]>>>18&31)]),y+=J[I+257],I>7&&(Mn(t,y,r[A]>>>23&31),y+=ag[I]);var G=31&r[A];bl(t,y,te[G]),y+=W[G],G>3&&(bl(t,y,r[A]>>>5&8191),y+=og[G])}else bl(t,y,F[r[A]]),y+=J[r[A]];return bl(t,y,F[256]),y+J[256]},hN=new _o([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),fN=(function(){for(var e=new _o(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),rm=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function pN(e,t){t===void 0&&(t={});var n=(function(){var v=4294967295;return{p(S){for(var w=v,R=0;S.length>R;++R)w=fN[255&w^S[R]]^w>>>8;v=w},d(){return 4294967295^v}}})(),r=e.length;n.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 j=0;b>=j;j+=65535){var C=j+65535;b>C?k=Sv(_,k,v.subarray(j,C)):(_[j]=!0,k=Sv(_,k,v.subarray(j,b)))}else{for(var T=hN[S-1],A=T>>>13,M=8191&T,L=(1<<w)-1,B=new mi(32768),q=new mi(L+1),F=Math.ceil(w/3),J=2*F,te=function(tt){return(v[tt]^v[tt+1]<<F^v[tt+2]<<J)&L},W=new _o(25e3),se=new mi(288),ee=new mi(32),H=0,$=0,O=(j=0,0),P=0,z=0;b>j;++j){var I=te(j),G=32767&j,ie=q[I];if(B[G]=ie,q[I]=G,j>=P){var X=b-j;if((H>7e3||O>24576)&&X>423){k=o1(v,_,0,W,se,ee,$,O,z,j-z,k),O=H=$=0,z=j;for(var V=0;286>V;++V)se[V]=0;for(V=0;30>V;++V)ee[V]=0}var ce=2,ae=0,Y=M,Z=G-ie&32767;if(X>2&&I==te(j-Z))for(var ue=Math.min(A,X)-1,we=Math.min(32767,j),Ae=Math.min(258,X);we>=Z&&--Y&&G!=ie;){if(v[j+ce]==v[j+ce-Z]){for(var Ie=0;Ae>Ie&&v[j+Ie]==v[j+Ie-Z];++Ie);if(Ie>ce){if(ce=Ie,ae=Z,Ie>ue)break;var $e=Math.min(Z,Ie-2),ct=0;for(V=0;$e>V;++V){var ut=j-Z+V+32768&32767,mt=ut-B[ut]+32768&32767;mt>ct&&(ct=mt,ie=ut)}}}Z+=(G=ie)-(ie=B[G])+32768&32767}if(ae){W[O++]=268435456|yv[ce]<<18|r1[ae];var et=31&yv[ce],vt=31&r1[ae];$+=ag[et]+og[vt],++se[257+et],++ee[vt],P=j+ce,++H}else W[O++]=v[j],++se[v[j]]}}k=o1(v,_,!0,W,se,ee,$,O,z,j-z,k)}return kC(p,0,R+EC(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&&rm(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),rm(m,y-8,n.d()),rm(m,y-4,r),m}var mN=!!Um||!!Wv,jC="text/plain",$d=!1,AC=(e,t)=>{var n=e.split("#"),r=n[1],o=n[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:"")},wh=function(e,t,n){var r;n===void 0&&(n=!0);var o=e.split("?"),c=o[0],f=o[1],l=je({},t),d=(r=f==null?void 0:f.split("&").map((y=>{var v,S=y.split("="),w=S[0],R=n&&(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 Xt(y,(function(x,g){Te(x)||Te(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},am=e=>{if(e.Vr)return e.Vr;var t=e.data,n=e.compression;if(t){if(n===si.GZipJS){var r=pN((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 kC(y,0,v)})(io(t)),{mtime:0});return{contentType:jC,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===si.Base64){var o=(function(l){return l&&btoa(encodeURIComponent(l).replace(/%([0-9A-F]{2})/g,((d,m)=>String.fromCharCode(parseInt(m,16)))))})(io(t)),c=(l=>"data="+encodeURIComponent(typeof l=="string"?l:io(l)))(o);return{contentType:"application/x-www-form-urlencoded",body:c,estimatedSize:new Blob([c]).size}}var f=io(t);return{contentType:"application/json",body:f,estimatedSize:new Blob([f]).size}}},RC=e=>{var t,n,r=()=>e.transport==="sendBeacon"?{url:wh(e.url,{compression:si.Base64}),encodedBody:am(je({},e,{compression:si.Base64,Vr:void 0}))}:{url:AC(e.url,"compression"),encodedBody:am(je({},e,{compression:void 0,Vr:void 0}))};try{t=am(e)}catch(o){if(Ab(e.compression,vo(e.url,"compression")))return Ne.error("Failed to gzip request body, sending uncompressed payload",o),r();throw o}return t&&Ab(e.compression,vo(e.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?qm(new Uint8Array(n)):ArrayBuffer.isView(n)&&qm(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?($d=!0,r()):{url:e.url,encodedBody:t}},TC=e=>{try{return RC(e)}catch(t){return Ne.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},vN=(function(){var e=os((function*(t){var n=io(t.data),r=yield(function(c,f,l){return Fm.apply(this,arguments)})(n,Pt.DEBUG,{rethrow:!0});if(!r)return t;var o=yield r.arrayBuffer();return je({},t,{Vr:{contentType:jC,body:o,estimatedSize:o.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),gN=/Failed to fetch|NetworkError|Load failed/i,NC=e=>{var t=TC(e);if(t){var n=t.url,r=t.encodedBody,o=r??{},c=o.contentType,f=o.body,l=o.estimatedSize,d=new Headers;Xt(e.headers,(function(R,x){d.append(x,R)})),c&&d.append("Content-Type",c);var m=null,y=!1;if(wb){var v=new wb;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"&&gN.test((x==null?void 0:x.message)||""))(R)?Ne.warn(R):Ne.error(R),e.callback==null||e.callback({statusCode:0,error:R})};try{var w;Wv(n,je({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){Ne.error(b)}e.callback==null||e.callback(g)})))).catch(S).finally((()=>m?clearTimeout(m.timeout):null))}catch(R){m&&clearTimeout(m.timeout),S(R)}}},wv=e=>{try{var t,n=RC(e),r=n.url,o=n.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(ii.sendBeacon(r,d))return;var m=nt(e.data)?e.data:(t=e.data)==null?void 0:t.batch;if(nt(m)&&m.length>1&&(l??0)>16384){var y=Math.ceil(m.length/2),v=S=>nt(e.data)?S:je({},e.data,{batch:S});return wv(je({},e,{data:v(m.slice(0,y))})),void wv(je({},e,{data:v(m.slice(y))}))}Ne.warn("Beacon of ~"+(l??0)+" bytes was rejected by the browser, falling back to fetch"),NC(je({},e,{Wr:!0}))}catch(S){Ne.warn("Beacon send failed",S)}},l1=(e,t,n,r)=>{var o=r==="query"?t==="POST"?"sent_at":"_":void 0;return wh(n===si.GZipJS?AC(e,"compression"):e,je({},o?{[o]:Date.now().toString()}:{},n===si.GZipJS?{}:{compression:n}))},Ld=[];Wv&&Ld.push({transport:"fetch",method:NC}),Um&&Ld.push({transport:"XHR",method(e){var t=TC(e);if(t){var n=new Um,r=t.encodedBody;n.open(e.method||"GET",t.url,!0);var o=r??{},c=o.contentType,f=o.body;Xt(e.headers,(function(l,d){n.setRequestHeader(d,l)})),c&&n.setRequestHeader("Content-Type",c),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var l={statusCode:n.status,text:n.responseText};if(n.status===200)try{l.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(l)}},n.send(f)}}}),ii!=null&&ii.sendBeacon&&Ld.push({transport:"sendBeacon",method:wv});var xv=3e3;class _N{constructor(t,n){this.Zr=!0,this.Gr=[],this.Qr=hn((n==null?void 0:n.flush_interval_ms)||xv,250,5e3,Ne.createLogger("flush interval"),xv),this.Jr=t}enqueue(t){this.Gr.push(t),this.Kr||this.Yr()}unload(){this.Xr();var t=this.Gr.length>0?this.ti():{},n=Object.values(t);[...n.filter((r=>r.url.indexOf("/e")===0)),...n.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.ei(je({},r,{transport:"sendBeacon"}))}))}enable(){this.Zr=!1,this.Yr()}Yr(){var t=this;this.Zr||(this.Kr=setTimeout((()=>{if(this.Xr(),this.Gr.length>0){var n=this.ti(),r=function(){var c=n[o],f=new Date().getTime();c.data&&nt(c.data)&&Xt(c.data,(l=>{l.offset=Math.abs(l.timestamp-f),delete l.timestamp})),t.ei(c)};for(var o in n)r()}}),this.Qr))}ei(t){try{this.Jr(t)}catch(n){Ne.error(n)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ti(){var t={};return Xt(this.Gr,(n=>{var r,o=n,c=(o?o.batchKey:null)||o.url;Te(t[c])&&(t[c]=je({},o,{data:[]})),(r=t[c].data)==null||r.push(o.data)})),this.Gr=[],t}}var yN=["retriesPerformedSoFar"];class bN{constructor(t){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=t,this.Gr=[],this.ni=!0,!Te(me)&&"onLine"in me.navigator&&(this.ni=me.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},hs(me,"online",this.si),hs(me,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(t){var n=t.retriesPerformedSoFar,r=ox(t,yN);In(n)&&(r.url=wh(r.url,{retry_count:n})),this._instance._send_request(je({},r,{callback:o=>{if(o.statusCode!==200&&(400>o.statusCode||o.statusCode>=500)){if((o.statusCode===0?3:10)>(n??0))return void this.Ot(je({retriesPerformedSoFar:n},r));o.statusCode===0&&Ne.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(n??0)+" retries.")}r.callback==null||r.callback(o)}}))}Ot(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=(function(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))})(n),o=Date.now()+r;this.Gr.push({retryAt:o,requestOptions:t});var c="Enqueued failed request for retry in "+r;navigator.onLine||(c+=" (Browser is offline)"),Ne.warn(c),this.ri||(this.ri=!0,this.li())}li(){if(this.ui&&clearTimeout(this.ui),this.Gr.length===0)return this.ri=!1,void(this.ui=void 0);this.ui=setTimeout((()=>{this.ni&&this.Gr.length>0&&this.oi(),this.li()}),this.ii)}oi(){var t=Date.now(),n=[],r=this.Gr.filter((c=>t>c.retryAt||(n.push(c),!1)));if(this.Gr=n,r.length>0)for(var o of r)this.retriableRequest(o.requestOptions)}unload(){for(var t of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,Te(me)||(this.si&&(me.removeEventListener("online",this.si),this.si=void 0),this.ai&&(me.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var n=t.requestOptions;try{this._instance._send_request(je({},n,{transport:"sendBeacon"}))}catch(r){Ne.error(r)}}this.Gr=[]}}class SN{constructor(t){this.hi=()=>{var n,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,(n=this.di.maxScrollY)!==null&&n!==void 0?n: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(){hs(me,"scroll",this.hi,{capture:!0}),hs(me,"scrollend",this.hi,{capture:!0}),hs(me,"resize",this.hi)}scrollElement(){if(!this.ci)return me==null?void 0:me.document.documentElement;var t=nt(this.ci)?this.ci:[this.ci];for(var n of t){var r=me==null?void 0:me.document.querySelector(n);if(r)return r}}vi(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.ci){var r=this.scrollElement();return r&&r[n]||0}return me?t==="y"?me.scrollY||me.pageYOffset||me.document.documentElement.scrollTop||0:me.scrollX||me.pageXOffset||me.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}}var wN=e=>_C(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 c1{constructor(t,n,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({[dv]:l})}},this._instance=t,this.yi=n,this.mi=r,this.gi=o||wN,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[dv]}getSetOnceProps(){var t,n=(t=this.pi())==null?void 0:t.props;return n?"r"in n?yC(n,this._instance.config.disable_capture_url_hashes):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return Xt(sg(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+Vm(r)]=n})),t}}class lg{on(t,n){return this.bi[t]||(this.bi[t]=[]),this.bi[t].push(n),()=>{this.bi[t]=this.bi[t].filter((r=>r!==n))}}emit(t,n){for(var r of this.bi[t]||[])r(n);for(var o of this.bi["*"]||[])o(t,n)}constructor(){this.bi={}}}var wl=cs("[SessionId]");class u1{on(t,n){return this.wi.on(t,n)}constructor(t,n,r){var o;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new lg,this.Mi=(m,y)=>!(!In(m)||!In(y))&&Math.abs(m-y)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===zn)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Te=t.config,this.mi=t.persistence,this.Ii=void 0,this.Ti=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ei=n||Hn,this.Ri=r||Hn;var c=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*hn(this.Te.session_idle_timeout_seconds||1800,60,36e3,wl.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=Vs.F(this.Oi),l=Vs.F(this.Fi);f&&!l?this.Ii=f:Vs.D(this.Oi),Vs.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){wl.error("Invalid sessionID in bootstrap",m)}this.Li()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Te(this.ki)&&(this.ki=[]),this.ki.push(t),this.Ti&&t(this.Ti,this.Ii),()=>{this.ki=this.ki.filter((n=>n!==t))}}Ai(){return this.Te.persistence!=="memory"&&!this.mi.yr&&Vs.N()}Di(t){t!==this.Ii&&(this.Ii=t,this.Ai()&&Vs.A(this.Oi,t))}Ni(){return this.Ii?this.Ii:this.Ai()?Vs.F(this.Oi):null}qi(t){var n=this.xi;return!ni(n)&&!ni(t)&&5e3>Math.abs(t-n)}$i(t,n,r){var o=n!==this._sessionActivityTimestamp,c=!(t!==this.Ti||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Ti=t,c&&!o||c&&this.qi(n)||(this.xi=n,this.mi.register({[so]:[n,t,r]}))}ji(){var t,n=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return In(n)&&n>0}Bi(){this.ji()?this.mi.refreshKey(so):(this.mi.flush(),this.mi.load())}Hi(){var t;if(!ni(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Bi();var n=this.Ui();n[1]===this.Ti&&n[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[so]:[this._sessionActivityTimestamp,(t=this.Ti)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var t=this.Ui()[0],n=In(t)?t:0,r=In(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,r)}Vi(t){return this.Bi(),this.Mi(t,this.zi())}Ui(){var t=this.mi.props[so];return nt(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&&me&&(me.removeEventListener(sh,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Li(){this.Si=()=>{this.Hi(),this.Ai()&&Vs.D(this.Fi)},hs(me,sh,this.Si,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.Te.cookieless_mode===zn)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),o=this.Ui(),c=o[1],f=o[2],l=this.zi(),d=this.Ni(),m=In(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))||wl.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(),wl.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)&&(wl.info("adopted cross-tab session id",{sessionId:c,windowId:d}),y=!0));var g=In(l)&&t&&!m?l:r,b=In(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 MC=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&Tb(n,t))return!0;try{var r=e==null?void 0:e.userAgentData;if(r!=null&&r.brands&&r.brands.some((o=>Tb(o==null?void 0:o.brand,t))))return!0}catch{}return!!e.webdriver};function OC(){return(OC=os((function*(){var e=ii==null?void 0:ii.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return Yt(n)&&n.length>0?n:void 0}catch(r){return void Ne.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",r)}}))).apply(this,arguments)}var ch=function(e,t){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function om(e,t,n){return io({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var DC={exact:(e,t)=>t.some((n=>e.some((r=>n===r)))),is_not:(e,t)=>t.every((n=>e.every((r=>n!==r)))),regex:(e,t)=>t.some((n=>e.some((r=>ch(n,r))))),not_regex:(e,t)=>t.every((n=>e.every((r=>!ch(n,r))))),icontains:(e,t)=>t.map(Eu).some((n=>e.map(Eu).some((r=>n.includes(r))))),not_icontains:(e,t)=>t.map(Eu).every((n=>e.map(Eu).every((r=>!n.includes(r))))),gt:(e,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&e.some((o=>r>parseFloat(o)))})),lt:(e,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&e.some((o=>r<parseFloat(o)))}))},Eu=e=>e.toLowerCase();function $C(e,t){return!e||Object.entries(e).every((n=>{var r=n[1],o=t==null?void 0:t[n[0]];if(Te(o)||ni(o))return!1;var c=[String(o)],f=DC[r.operator];return!!f&&f(r.values,c)}))}var Cv="custom",d1="i.posthog.com",xN=/^\/static\//;class CN{constructor(t){this.Zi={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,n=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+d1,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.Zi[this.apiHost]||(this.Zi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":Cv),this.Zi[this.apiHost]}Gi(t){if(xN.test(t)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.uiHost+n;if(t==="flags")return this.flagsApiHost+n;if(t==="assets"){var r=this.Gi(n);if(r)return""+r+n}if(this.region===Cv)return this.apiHost+n;var o=d1+n;switch(t){case"assets":return"https://"+this.region+"-assets."+o;case"api":return"https://"+this.region+"."+o}}}function LC(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var qt=cs("[Surveys]"),IC="seenSurvey_",PC=e=>{try{var t=(n=>((r,o)=>""+IC+(function(c){return c.current_iteration&&c.current_iteration>0?c.id+"_"+c.current_iteration:c.id})(o))(0,n))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(n){qt.error("Failed to persist survey seen state",n)}},EN=[sm.Popover,sm.Widget,sm.API],kN={ignoreConditions:!1,ignoreDelay:!1,displayType:_v.Popover},jN=cs("[PostHog ExternalIntegrations]"),AN={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class RN{constructor(t){this._instance=t}tr(t,n){var r;(r=Ue.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,t,(o=>{if(o)return jN.error("failed to load script",o);n()}))}startIfEnabledOrStop(){var t=this,n=function(){var c,f,l,d=r[0],m=r[1];!m||(c=Ue.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[d]||t.tr(AN[d],(()=>{var y;(y=Ue.__PosthogExtensions__)==null||(y=y.integrations)==null||(y=y[d])==null||y.start(t._instance)})),!m&&(f=Ue.__PosthogExtensions__)!=null&&(f=f.integrations)!=null&&f[d]&&((l=Ue.__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;n()}}}class TN{constructor(t,n){this.it=t,this.Qi=n,this.Ji=new Map,this.Ki=!1}add(t){var n=this;return os((function*(){if(n.Ki)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.Ji.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');n.Ji.set(t.name,t);try{var r=t.setup(n.Qi);r&&(yield r)}catch(c){var o=n.Ji.get(t.name)===t;o&&n.Ji.delete(t.name),n.it.error('Failed to set up browser extension "'+t.name+'"',c),o&&n.Yi(t)}}))()}dispose(){if(!this.Ki){this.Ki=!0;var t=Array.from(this.Ji.values()).reverse();for(var n of(this.Ji.clear(),t))this.Yi(n)}}Yi(t){try{var n=t.dispose==null?void 0:t.dispose();n&&Ai(n.then)&&n.then(void 0,(r=>{this.it.error('Failed to dispose browser extension "'+t.name+'"',r)}))}catch(r){this.it.error('Failed to dispose browser extension "'+t.name+'"',r)}}}class NN{constructor(t){this._instance=t}get(t){var n;return(n=this._instance.persistence)==null?void 0:n.get_property(t)}set(t,n){var r;(r=this._instance.persistence)==null||r.set_property(t,n)}remove(t){var n;(n=this._instance.persistence)==null||n.unregister(t)}}var h1="extensionsRemoteConfig";class MN{constructor(t){this.Ki=!1,this.instance=t,this.it=Ne.createLogger("[BrowserExtensions]"),this.Xi=t.tn,this.kv=new NN(t),this.onEvent=n=>Cu(this.instance.on("eventCaptured",(r=>{try{n({event:r.event,properties:r.properties})}catch(o){this.it.error("Browser extension event listener failed",o)}}))),this.onRemoteConfig=n=>{if(this.Ki)return Cu((()=>{}));var r=c=>{try{n(c)}catch(f){this.it.error("Browser extension remote config listener failed",f)}},o=this.instance.en.on(h1,r);return this.Xi&&r(this.Xi),Cu(o)},this.rn=new TN(this.it,this)}get logger(){return this.it}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return(t=this.instance.get_property(Gl))!==null&&t!==void 0?t:this.distinctId}get groups(){return this.instance.getGroups()}get session(){try{var t,n,r,o,c=(t=this.instance.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=c==null?void 0:c.sessionId)!==null&&n!==void 0?n:"",windowId:(r=c==null?void 0:c.windowId)!==null&&r!==void 0?r:"",sessionStartTimestamp:(o=c==null?void 0:c.sessionStartTimestamp)!==null&&o!==void 0?o:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(t){return this.rn.add(t)}capture(t,n,r){var o=this;return os((function*(){r?o.instance.capture(t,n,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):o.instance.capture(t,n)}))()}registerDynamicEventProperties(t){return Cu(this.instance.nn(t))}handleRemoteConfig(t){this.Ki||(this.Xi=t,this.instance.en.emit(h1,t))}sendRequest(t,n){var r=this;return os((function*(){var o;n===void 0&&(n={});var c=r.instance.requestRouter.endpointFor((o=n.target)!==null&&o!==void 0?o:"api",t),f={method:n.method,url:n.query?wh(c,n.query):c,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport};return n.transport==="sendBeacon"?(r.instance._send_request(f),{statusCode:202}):new Promise((l=>{f.callback=l,r.instance._send_request(f)}))}))()}dispose(){this.Ki||(this.Ki=!0,this.rn.dispose())}}var ql={},lm=0,uh=()=>{},f1='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',xl="Surveys module not available",p1="sanitize_properties is deprecated. Use before_send instead",BC="Invalid value for property_denylist config: ",ON=["token","distinct_id",Wx],to="posthog",HC=!mN&&(pi==null?void 0:pi.indexOf("MSIE"))===-1&&(pi==null?void 0:pi.indexOf("Mozilla"))===-1,cm=e=>{var t;return je({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:D3(Le==null?void 0:Le.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:uh,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:Cs&&Yt(Cs==null?void 0:Cs.search)&&Cs.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:(me==null||(t=me.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){Ne.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:mv,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:xv},error_tracking:{},_onCapture:uh},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:W3,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:n&&n>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n)}))(e))},DN=[["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"]],m1=e=>{var t={};for(var n of DN){var r=n[0],o=n[1];Te(e[r])||(t[o]=e[r])}var c=es({},t,e),f=e.__preview_external_dependency_versioned_paths;return Te(f)||(Te(e.strict_script_versioning)&&(c.strict_script_versioning=!!f),Yt(f)&&Te(e.asset_host)&&(c.asset_host=f)),nt(e.property_blacklist)&&(Te(e.property_denylist)?c.property_denylist=e.property_blacklist:nt(e.property_denylist)?c.property_denylist=[...e.property_blacklist,...e.property_denylist]:Ne.error(BC+e.property_denylist)),c};class $N{constructor(){this.__forceAllowLocalhost=!1}get sn(){return this.__forceAllowLocalhost}set sn(t){Ne.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Vi{an(t,n){if(t){var r=this.Ji.indexOf(t);r!==-1&&this.Ji.splice(r,1)}return this.Ji.push(n),n.initialize==null||n.initialize(),n}ln(){return this.config.cookieless_mode===zn||this.config.cookieless_mode===sa&&this.consent.isRejected()}get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.webPerformance=new $N,this.un=!1,this.version=Pt.LIB_VERSION,this.en=new lg,this.Ji=[],this.hn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=cm(),this.SentryIntegration=eN,this.sentryIntegration=r=>(function(o,c){var f=dC(o,c);return{name:uC,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 SN(this),this.pageViewManager=new e1(this),this.rateLimiter=new cN(this),this.requestRouter=new CN(this),this.consent=new z3(this),this.externalIntegrations=new RN(this);var n=(t=Vi.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(r,o,c)=>{var f=Yt(r)?{[r]:o}:r;this.setPersonProperties(f),c==null||c({})},set_once:(r,o,c)=>{var f=Yt(r)?{[r]:o}:r;this.setPersonProperties(void 0,f),c==null||c({})}},this.on("eventCaptured",(r=>Ne.info('send "'+(r==null?void 0:r.event)+'"',r)))}init(t,n,r){if(r&&r!==to){var o,c=(o=ql[r])!==null&&o!==void 0?o:new Vi;return c._init(t,n,r),ql[r]=c,ql[to][r]=c,c}return this._init(t,n,r)}_init(t,n,r){var o,c;n===void 0&&(n={});var f=Yt(t)?t.trim():"";if(!f)return Ne.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=cm(n.defaults),n.debug=this.pn(n.debug),this.gn=n,this.mn=[],n.person_profiles?this.vn=n.person_profiles:n.process_person&&(this.vn=n.process_person);var l=cm(n.defaults),d=m1(n),m=es({},l,d,{name:r,token:f});as(l.rageclick)&&as(d.rageclick)&&(m.rageclick=es({},l.rageclick,d.rageclick)),as(l.session_recording)&&as(d.session_recording)&&(m.session_recording=es({},l.session_recording,d.session_recording)),this.set_config(m),this.config.on_xhr_error&&Ne.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:si.GZipJS;var y=this.yn();this.persistence=new tm(this.config,y),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new tm(je({},this.config,{persistence:"sessionStorage"}),y,!1);var v=je({},this.persistence.props),S=je({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.bn=new _N((k=>this._n(k)),this.config.request_queue_config),this.wn=new bN(this),this.__request_queue=[];var w=this.ln();if(w||(this.sessionManager=new u1(this),this.sessionPropsManager=new c1(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Ne.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.xn(w)}),0)):(Ne.info("Initializing extensions synchronously"),this.xn(w)),Pt.DEBUG=Pt.DEBUG||this.config.debug,Pt.DEBUG&&Ne.info("Starting in debug mode",{this:this,config:n,thisC:je({},this.config),p:v,s:S}),!this.config.identity_distinct_id||(o=n.bootstrap)!=null&&o.distinctID||(n.bootstrap=je({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((c=n.bootstrap)==null?void 0:c.distinctID)!==void 0){var R=n.bootstrap.distinctID,x=this.get_distinct_id(),g=this.persistence.get_property(Fi);if(n.bootstrap.isIdentifiedID&&x!=null&&x!==R&&g===Fa)this.identify(R);else if(n.bootstrap.isIdentifiedID&&x!=null&&x!==R&&g===qr)Ne.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(Hn()),p=n.bootstrap.isIdentifiedID?b:R;this.persistence.set_property(Fi,n.bootstrap.isIdentifiedID?qr:Fa),this.register({distinct_id:R,$device_id:p})}}if(w)this.register_once({distinct_id:yu,$device_id:null},"");else if(!this.get_distinct_id()){var _=this.config.get_device_id(Hn());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(Fi,Fa)}return hs(me,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(k,j){var C=k.config.segment;if(!C)return j();(function(T,A){var M=T.config.segment;if(!M)return A();var L=q=>{var F=()=>q.anonymousId()||Hn();T.config.get_device_id=F,q.id()&&(T.register({distinct_id:q.id(),$device_id:F()}),T.persistence.set_property(Fi,qr)),A()},B=M.user();"then"in B&&Ai(B.then)?B.then(L):L(B)})(k,(()=>{C.register((T=>{typeof Promise<"u"&&Promise.resolve||Qp.warn("This browser does not have Promise support, and can not use the segment integration");var A=(M,L)=>{if(!L)return M;M.event.userId||M.event.anonymousId===T.get_distinct_id()||(Qp.info("No userId set, resetting PostHog"),T.reset()),M.event.userId&&M.event.userId!==T.get_distinct_id()&&(Qp.info("UserId set, identifying with PostHog"),T.identify(M.event.userId));var B=T.calculateEventProperties(L,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=>A(M,M.event.event),page:M=>A(M,eo),identify:M=>A(M,Xp),screen:M=>A(M,"$screen")}})(k)).then((()=>{j()}))}))})(this,(()=>this.kn())):this.kn(),Ai(this.config._onCapture)&&this.config._onCapture!==uh&&(Ne.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&Ne.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 OC.apply(this,arguments)})().then((k=>{k&&this.register({[Kp]:k})})).catch(uh),this}xn(t){var n,r,o,c,f,l,d,m,y=performance.now(),v=je({},Vi.__defaultExtensionClasses,this.config.__extensionClasses),S=[];v.featureFlags&&this.Ji.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n: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,Q3)),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,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.Cn(t,n)}),0);var r=t.shift();if(r)try{r()}catch(c){Ne.error("Error initializing extension:",c)}}var o=Math.round(performance.now()-n);this.register_for_session({[Gx]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Kx]:o}),this.config.__preview_deferred_init_extensions&&Ne.info("PostHog extensions initialized ("+o+"ms)")}Br(t){var n;if(!Le||!Le.body)return Ne.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=Ye(o.supportedCompression,si.GZipJS)?si.GZipJS:Ye(o.supportedCompression,si.Base64)?si.Base64:void 0),(r=o.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=o.analytics.endpoint)}this.set_config({person_profiles:this.vn?this.vn:mv}),(n=this.Mn)==null||n.handleRemoteConfig(t),this.Ji.forEach((c=>c.onRemoteConfig==null?void 0:c.onRemoteConfig(t)))}kn(){try{this.config.loaded(this)}catch(r){Ne.critical("`loaded` function failed",r)}if(this.In(),this.config.internal_or_test_user_hostname&&Cs!=null&&Cs.hostname){var t=Cs.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.ln())&&this.Tn()}),1),this.En=new SC(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()&&bu(this.__request_queue,(t=>this._n(t))),this.__request_queue=[],this.In()}_handle_unload(){var t,n,r,o,c;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.Rn()&&this.capture(Yp),(r=this.logs)==null||r.flushLogs("sendBeacon"),(o=this.bn)==null||o.unload(),(c=this.wn)==null||c.unload()):this.Rn()&&this.capture(Yp,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?HC?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=je({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(Te(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var r,o,c,f=je({},n);f.timeout=f.timeout||6e4;var l,d,m,y,v,S=(r=f.transport)!==null&&r!==void 0?r:"fetch";S==="sendBeacon"&&Te(f.compression)&&f.data&&(f.compression=si.Base64),f.method==="POST"&&f.data&&(f.timestampMode==="capture-body"?f.data={api_key:(d=(v=(y=nt(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()),nt(x)?x.map((b=>je({},b,{sent_at:g}))):je({},x,{sent_at:g})})(f.data))),f.url=l1(f.url,f.method,f.compression,f.timestampMode);var w=Ld.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===si.GZipJS&<&&typeof Promise<"u"&&!$d?vN(f).then((x=>{R(x)})).catch((x=>{if(Rb(x))return $d=!0,void R(je({},f,{compression:void 0,url:l1(n.url,n.method,void 0,n.timestampMode)}));(g=>{if(!g||typeof g!="object")return!1;var b="name"in g?String(g.name):"";return Rb(g)||b===lx})(x)&&($d=!0),R(f)})):R(f)})(je({},t,{callback:n=>{var r,o;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(r=(o=this.config).on_request_error)==null||r.call(o,n),t.callback==null||t.callback(n)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}_n(t){this.wn?this.wn.retriableRequest(t):this._send_request(t)}_execute_array(t){lm++;try{var n,r=[],o=[],c=[];bu(t,(l=>{if(l)if(nt(n=l[0]))c.push(l);else if(Ai(l))try{l.call(this)}catch(d){Ne.error("Error executing queued PostHog call",l,d)}else nt(l)&&n==="alias"?r.push(l):nt(l)&&n.indexOf("capture")!==-1&&Ai(this[n])?c.push(l):o.push(l)}));var f=function(l,d){bu(l,(function(m){try{if(nt(m[0])){var y=d;Xt(m,(function(v){y=y[v[0]].apply(y,v.slice(1))}))}else d[m[0]].apply(d,m.slice(1))}catch(v){Ne.error("Error executing queued PostHog call",m,v)}}))};f(r,this),f(o,this),f(c,this)}finally{lm--}}push(t){if(lm>0&&nt(t)&&Yt(t[0])){var n=Vi.prototype[t[0]];Ai(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,r){var o,c,f,l,d,m,y;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.bn){if(this.is_capturing())if(!Te(t)&&Yt(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{es(w,R())}catch($){Ne.error("Failed to produce browser extension event properties",$)}n=je({},w,n??{})}var x;(o=n)!=null&&o.$current_url&&!Yt((c=n)==null?void 0:c.$current_url)&&(Ne.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),(x=n)==null||delete x.$current_url),t!=="$exception"||r!=null&&r.Pn||Ne.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=Db(r==null?void 0:r.uuid,Hn),_={uuid:p,event:t,properties:this.calculateEventProperties(t,n||{},b,p)};t===eo&&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(Jd)===!0;r!=null&&r.$set&&!k&&(_.$set=r==null?void 0:r.$set);var j=r==null?void 0:r.$unset;j&&(_.$unset=j);var C,T,A,M=k?void 0:this.On(r==null?void 0:r.$set_once,t!==Bb,t===Xp);if(M&&(_.$set_once=M),r!=null&&r._noTruncate||(l=this.config.properties_string_max_length,d=_,m=$=>Yt($)?$.slice(0,l):$,y=new Set,_=(function $(O,P){if(O!==Object(O))return m?m(O):O;if(!y.has(O)){var z;if(y.add(O),nt(O))z=[],bu(O,(G=>{z.push($(G))}));else{var I={};Xt(O,((G,ie)=>{y.has(G)||(I[ie]=$(G))})),z=I}return z}})(d)),_.timestamp=b,Te(r==null?void 0:r.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=g),k&&(_.properties=(function($,O){O===void 0&&(O=[]);var P={},z=I=>{$[I]!==void 0&&(P[I]=$[I])};return IT.forEach(z),O.forEach(z),P})(_.properties,ON)),t===qn.DISMISSED||t===qn.SENT){var L,B,q=(L=n)==null?void 0:L[im.SURVEY_ID],F=(B=n)==null?void 0:B[im.SURVEY_ITERATION];PC({id:q,current_iteration:F}),_.$set=je({},_.$set,{[(C={id:q,current_iteration:F},T=t===qn.SENT?"responded":"dismissed",A="$survey_"+T+"/"+C.id,C.current_iteration&&C.current_iteration>0&&(A="$survey_"+T+"/"+C.id+"/"+C.current_iteration),A)]:!0})}else t===qn.SHOWN&&(_.$set=je({},_.$set,{[im.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===lN.SHOWN){var J,te=(J=n)==null?void 0:J[s1.TOUR_TYPE];te&&(_.$set=je({},_.$set,{[s1.TOUR_LAST_SEEN_DATE+"/"+te]:new Date().toISOString()}))}var W=je({},_.properties.$set,_.$set);if(_r(W)||this.setPersonPropertiesForFlags(W),!at(this.config.before_send)){var se=this.Rt(_);if(!se)return;(_=se).uuid=Db(_.uuid,Hn)}this.en.emit("eventCaptured",_);var ee=(f=r==null?void 0:r._url)!==null&&f!==void 0?f:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),H={method:"POST",url:ee,data:_,compression:"best-available",timestampMode:(r==null?void 0:r._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(ee)?"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(H):this.bn.enqueue(H),_}Ne.critical("This capture call is ignored due to client rate limiting.")}}else Ne.error("No event name provided to posthog.capture")}else Ne.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}Fn(){var t;return(t=this.Mn)!==null&&t!==void 0?t:this.Mn=new MN(this)}nn(t){this.hn.push(t);var n=!0;return()=>{if(n){n=!1;var r=this.hn.indexOf(t);r!==-1&&this.hn.splice(r,1)}}}calculateEventProperties(t,n,r,o,c){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var f=c?void 0:this.persistence.remove_event_timer(t),l=je({},n);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.ln()&&(l[Wx]=!0),t==="$snapshot"){var d=je({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=d.distinct_id,(!Yt(l.distinct_id)&&!Ws(l.distinct_id)||Wm(l.distinct_id))&&Ne.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var m,y=(function(_,k,j,C){var T,A,M,L;if(C===void 0&&(C=!1),!pi)return{};var B,q=_?[...go,...k||[]]:[],F=(function(ue){for(var we=0;Mb.length>we;we++){var Ae=Mb[we],Ie=Ae[1],$e=Ae[0].exec(ue),ct=$e&&(Ai(Ie)?Ie($e,ue):Ie);if(ct)return ct}return["",""]})(pi),J=F[0],te=F[1],W=(B=typeof navigator<"u"?navigator:void 0)!=null&&B.brave?{brave:!0}:{},se={};Te(j)||(se.detectGoogleSearchApp=j);var ee={},H=(T=navigator)==null||(T=T.userAgentData)==null?void 0:T.platform,$=(A=navigator)==null?void 0:A.maxTouchPoints,O=me==null||(M=me.screen)==null?void 0:M.width,P=me==null||(L=me.screen)==null?void 0:L.height,z=me==null?void 0:me.devicePixelRatio;Te(H)||(ee.userAgentDataPlatform=H),Te($)||(ee.maxTouchPoints=$),Te(O)||(ee.screenWidth=O),Te(P)||(ee.screenHeight=P),Te(z)||(ee.devicePixelRatio=z);var I,G,ie,X,V,ce,ae,Y,Z=es(sg({$os:J,$os_version:te,$browser:Mx(pi,navigator.vendor,W,se),$device:Ob(pi),$device_type:(G=pi,ie=ee,Y=Ob(G),Y===px||Y===fx||Y==="Kobo"||Y==="Kindle Fire"||Y===jx?fo:Y===Vl||Y===lo||Y===Wl||Y===Km?"Console":Y===vx?"Wearable":Y?Ni:(ie==null?void 0:ie.userAgentDataPlatform)==="Android"&&((X=ie==null?void 0:ie.maxTouchPoints)!==null&&X!==void 0?X:0)>0?600>Math.min((V=ie==null?void 0:ie.screenWidth)!==null&&V!==void 0?V:0,(ce=ie==null?void 0:ie.screenHeight)!==null&&ce!==void 0?ce:0)/((ae=ie==null?void 0:ie.devicePixelRatio)!==null&&ae!==void 0?ae:1)?Ni:fo:"Desktop"),$timezone:bC(),$timezone_offset:rN()}),{$current_url:Xl(C?Sr(Cs==null?void 0:Cs.href):Cs==null?void 0:Cs.href,q,Jl),$host:Cs==null?void 0:Cs.host,$pathname:Cs==null?void 0:Cs.pathname,$raw_user_agent:pi.length>1e3?pi.substring(0,997)+"...":pi,$browser_version:s3(pi,navigator.vendor,W,se),$browser_language:t1(),$browser_language_prefix:(I=t1(),typeof I=="string"?I.split("-")[0]:void 0),$screen_height:me==null?void 0:me.screen.height,$screen_width:me==null?void 0:me.screen.width,$viewport_height:me==null?void 0:me.innerHeight,$viewport_width:me==null?void 0:me.innerWidth,$lib:Pt.LIB_NAME,$lib_version:Pt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Pt.SDK_DIST_CHANNEL&&(Z.$sdk_dist_channel=Pt.SDK_DIST_CHANNEL),Z})(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&&es(l,this.sessionPropsManager.getSessionProps());try{var w;this.sessionRecording&&es(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===Cv&&(l.$lib_custom_api_host=this.config.api_host),m=t!==eo||c?t!==Yp||c?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),l=es(l,m),t===eo&&Le&&(l.title=Le.title),!Te(f)){var R=r.getTime()-f;l.$duration=parseFloat((R/1e3).toFixed(3))}pi&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var x=this.persistence.properties(),g=this.sessionPersistence.properties();Xt(["$referrer","$referring_domain"],(_=>{_ in x&&delete g[_]})),(l=es({},y,x,g,l)).$is_identified=this._isIdentified(),nt(this.config.property_denylist)?Xt(this.config.property_denylist,(function(_){delete l[_]})):Ne.error(BC+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(Ne.error(p1),l=b(l,t));var p=this.An();return l.$process_person_profile=p,p&&!c&&this.$n("_calculate_event_properties"),l}On(t,n,r){var o;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this.An()||this.un&&!r)return t;var c=this.persistence.get_initial_props(),f=(o=this.sessionPropsManager)==null?void 0:o.getSetOnceProps(),l=es({},c,f||{},t||{}),d=this.config.sanitize_properties;return d&&(Ne.error(p1),l=d(l,"$set_once")),n&&(this.un=!0),_r(l)?void 0:l}register(t,n){var r;(r=this.persistence)==null||r.register(t,n)}register_once(t,n,r){var o;(o=this.persistence)==null||o.register_once(t,n,r)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t)}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t)}Ln(t,n){this.register({[t]:n})}getFeatureFlag(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(t,n)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var r,o;return(r=(o=this.featureFlags)==null?void 0:o.isFeatureEnabled(t,n))!==null&&r!==void 0?r:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,r){var o;(o=this.featureFlags)==null||o.updateFlags(t,n,r)}updateEarlyAccessFeatureEnrollment(t,n,r){var o;(o=this.featureFlags)==null||o.updateEarlyAccessFeatureEnrollment(t,n,r)}getEarlyAccessFeatures(t,n,r){var o;return n===void 0&&(n=!1),(o=this.featureFlags)==null?void 0:o.getEarlyAccessFeatures(t,n,r)}on(t,n){return this.en.on(t,n)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:xl}),()=>{})}onSessionId(t){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:xl})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:xl})}renderSurvey(t,n){var r;(r=this.surveys)==null||r.renderSurvey(t,n)}displaySurvey(t,n){var r;n===void 0&&(n=kN),(r=this.surveys)==null||r.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:xl}}canRenderSurveyAsync(t,n){var r,o;return n===void 0&&(n=!1),(r=(o=this.surveys)==null?void 0:o.canRenderSurveyAsync(t,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:xl})}Dn(t){return!t||Wm(t)?(Ne.critical("Unique user id has not been set in posthog.identify"),!1):t===yu?(Ne.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())||(Ne.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,n,r){if(!this.__loaded||!this.persistence)return Ne.uninitializedWarning("posthog.identify");if(Ws(t)&&(t=t.toString(),Ne.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(Gl)||this.register_once({$had_persisted_distinct_id:!0,$device_id:o},""),t!==o&&t!==this.get_property(Ml)&&(this.unregister(Ml),this.register({distinct_id:t}));var c,f=(this.persistence.get_property(Fi)||Fa)===Fa,l=t!==o,d=!l&&f;if(l&&f)this.persistence.set_property(Fi,qr),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.capture(Xp,{distinct_id:t,$anon_distinct_id:o},{$set:n||{},$set_once:r||{}}),this.fn=om(t,n,r),(c=this.featureFlags)==null||c.setAnonymousDistinctId(o);else if(d){this.persistence.set_property(Fi,qr);var m=n||{},y=r||{};this.setPersonPropertiesForFlags({$set:m,$set_once:y},!1),this.capture("$set",{$set:m,$set_once:y}),this.fn=om(t,n,r)}else(n||r)&&this.setPersonProperties(n,r);l?(this.reloadFeatureFlags(),this.unregister(Hl)):d&&(n||r)&&this.reloadFeatureFlags()}}setPersonProperties(t,n){if((t||n)&&this.$n("posthog.setPersonProperties")){var r=om(this.get_distinct_id(),t,n);this.fn!==r?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.fn=r):Ne.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,r=(nt(t)?t:[t]).filter((o=>Yt(o)&&o.length>0));r.length!==0&&this.$n("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.fn=null)}group(t,n,r){if(t&&n){var o=this.getGroups(),c=o[t]!==n;if(c&&this.resetGroupPropertiesForFlags(t),this.register({$groups:je({},o,{[t]:n})}),c||r){var f={$group_type:t,$group_key:n};r&&(f.$group_set=r),this.capture(Bb,f)}r&&this.setGroupPropertiesForFlags({[t]:r}),c&&!r&&this.reloadFeatureFlags()}else Ne.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),this.$n("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n,r,o,c,f,l,d,m,y,v;if(Ne.info("reset"),!this.__loaded)return Ne.uninitializedWarning("posthog.reset");var S,w=this.get_property(Gl),R=this.get_property(Kp),x=this.get_property(ra);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),Te(x)||(S=this.persistence)==null||S.register({[ra]: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,Fa),(v=this.sessionManager)==null||v.resetSessionId(),this.fn=null,this.config.cookieless_mode===zn)this.register_once({distinct_id:yu,$device_id:null},"");else{var g=this.config.get_device_id(Hn());this.register_once({distinct_id:g,$device_id:t?g:w},""),t||Te(R)||this.register({[Kp]: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 n=this;return os((function*(){var r,o,c,f,l,d,m;n.__loaded?((r=n.En)==null||r.stop(),(o=n.Mn)==null||o.dispose(),(c=n.logs)==null||c.flushLogs("sendBeacon"),(f=n.metrics)==null||f.flush("sendBeacon"),(l=n.bn)==null||l.unload(),(d=n.wn)==null||d.unload(),(m=n.featureFlags)==null||m.destroy()):Ne.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,n){var r;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(r=this.conversations)==null||r.Nn()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.qn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var n=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.sessionStartTimestamp,o=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(t!=null&&t.withTimestamp&&r){var c,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,n){return t===this.get_property(Hx)?(Ne.critical("Attempting to create alias for existing People user - aborting."),-2):this.$n("posthog.alias")?(Te(n)&&(n=this.get_distinct_id()),t!==n?(this.Ln(Ml,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Ne.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=je({},this.config);if(as(t)){var r,o,c,f,l,d,m,y,v,S,w;es(this.config,m1(t));var R=this.yn();(r=this.persistence)==null||r.update_config(this.config,n,R),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new tm(je({},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?(Pt.DEBUG=!0,Qt.N()&&Qt.A("ph_debug",!0),Ne.info("set_config",{config:t,oldConfig:n,newConfig:je({},this.config)})):(Pt.DEBUG=!1,Qt.N()&&Qt.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,n){Pt.LIB_NAME=t,Pt.LIB_VERSION=n}startSessionRecording(t){var n,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)&&((n=this.sessionManager)==null||n.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,n){if(this.exceptions){var r=new Error("PostHog syntheticException"),o=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(je({},o,n))}}addExceptionStep(t,n){var r;(r=this.exceptions)==null||r.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)==null||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)==null?void 0:n.logger)!==null&&t!==void 0?t:Vi.Bn}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:to;return n!==to&&(n=to+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(Fi))===qr||((n=this.sessionPersistence)==null?void 0:n.get_property(Fi))===qr}An(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===mv&&!this._isIdentified()&&_r(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Ml])&&((n=this.persistence)==null||(n=n.props)==null||!n[eh]))}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"?(Ne.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ln(eh,!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,n,r,o,c=this.yn();return((t=this.persistence)==null?void 0:t.yr)!==c&&((r=this.persistence)==null||r.set_disabled(c)),((n=this.sessionPersistence)==null?void 0:n.yr)!==c&&((o=this.sessionPersistence)==null||o.set_disabled(c)),c}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==zn){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 u1(this),this.pageViewManager=new e1(this),this.persistence&&(this.sessionPropsManager=new c1(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(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==sa&&((y=this.surveys)==null||y.loadIfEnabled()),(Te(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 Ne.warn(f1)}opt_out_capturing(){var t,n,r;this.config.cookieless_mode!==zn?(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:yu,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Tn(),this.In())):Ne.warn(f1)}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===zn||(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 ii?MC(ii,this.config.custom_blocked_useragents):void 0}Tn(){Le&&(Le.visibilityState==="visible"?this.dn||(this.dn=!0,this.capture(eo,{title:Le.title},{send_instantly:!0}),this.cn&&(Le.removeEventListener(th,this.cn),this.cn=null)):this.cn||(this.cn=this.Tn.bind(this),hs(Le,th,this.cn)))}debug(t){t===!1?(me==null||me.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(me==null||me.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?(Ne.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(n,r,o,c,f){var l=r in n&&!at(n[r]),d=o in n&&!at(n[o]);return l?n[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."),n[o])})(t,"advanced_disable_flags","advanced_disable_decide",0,Ne)}Rt(t){var n;if(at(this.config.before_send))return t;var r=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(FT),o=nt(this.config.before_send)?this.config.before_send:[this.config.before_send],c=t;for(var f of o){if(c=f(c),at(c)){var l="Event '"+t.event+"' was rejected in beforeSend function";return qT(t.event)?Ne.warn(l+". This can cause unexpected behavior."):Ne.info(l),null}c.properties&&!_r(c.properties)||Ne.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var d of r)if(c.properties&&at(c.properties[d]))return Ne.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,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(r)})}pn(t){var n=Qi(t)&&!t,r=Qt.N()&&Qt.q("ph_debug")==="true";return!n&&(!!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 n=0;t.length>n;n++)e.prototype[t[n]]=M3(e.prototype[t[n]])})(Vi,["identify"]);class v1{constructor(t){this.disabled=t===!1;var n=as(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,r){if(this.disabled)return!1;var o=this.clicks[this.clicks.length-1];if(o&&Math.abs(t-o.x)+Math.abs(n-o.y)<this.thresholdPx&&this.timeoutMs>r-o.timestamp){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var um="$copy_autocapture",dm=cs("[AutoCapture]");function hm(e,t){return t.length>e?t.slice(0,e)+"...":t}function LN(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!wr(t));return t}function IN(e,t){var n,r,o=t.e,c=t.maskAllElementAttributes,f=t.maskAllText,l=t.elementAttributeIgnoreList,d=t.elementsChainAsString,m=t.disableCaptureUrlHashes;if(!wr(e))return{props:{}};for(var y=[e],v=new Set([e]),S=e;S.parentNode&&!Ri(S,"body")&&iC>y.length;)if(sC(S.parentNode)){var w=S.parentNode.host;if(v.has(w))break;v.add(w),y.push(w),S=w}else{if(!wr(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(Xt(y,(A=>{var M=gv(A);if(Ri(A,"a")){var L=A.getAttribute("href");p=!!(M&&L&&zl(L))&&(m?Sr(L):L)}Ye(nh(A),"ph-no-capture")&&(_=!0),g.push((function(q,F,J,te,W){W===void 0&&(W=!1);var se=q.tagName.toLowerCase(),ee={tag_name:se};ng.indexOf(se)>-1&&!J&&(ee.$el_text=se.toLowerCase()==="a"||se.toLowerCase()==="button"?hm(1024,Jb(q)):hm(1024,Yl(q)));var H=nh(q);H.length>0&&(ee.classes=H.filter((function(z){return z!==""}))),Xt(q.attributes,(function(z){var I;if((!lC(q)||["name","id","class","aria-label"].indexOf(z.name)!==-1)&&(te==null||!te.includes(z.name))&&!F&&zl(z.value)&&(!Yt(I=z.name)||I.substring(0,10)!=="_ngcontent"&&I.substring(0,7)!=="_nghost")){var G=z.value;z.name==="class"&&(G=ig(G).join(" ")),ee["attr__"+z.name]=hm(1024,z.name==="href"&&W?Sr(G):G)}}));for(var $=1,O=1,P=q;P=LN(P);)$++,P.tagName===q.tagName&&O++;return ee.nth_child=$,ee.nth_of_type=O,ee})(A,c,f,l,m));var B=(function(q){if(!gv(q))return{};var F={};return Xt(q.attributes,(function(J){if(J.name&&J.name.indexOf("data-ph-capture-attribute")===0){var te=J.name.replace("data-ph-capture-attribute-",""),W=J.value;te&&W&&zl(W)&&(F[te]=W)}})),F})(A);es(b,B)})),_)return{props:{},explicitNoCapture:_};if(f||(g[0].$el_text=Ri(e,"a")||Ri(e,"button")?Jb(e):Yl(e)),p){var k,j;g[0].attr__href=p;var C=(k=rh(p))==null?void 0:k.host,T=me==null||(j=me.location)==null?void 0:j.host;C&&T&&C!==T&&(R=p)}return{props:es({$event_type:o.type,$ce_version:1},d?{}:{$elements:g},{$elements_chain:(x=g,(function(A){return A.map((M=>{var L,B,q="";if(M.tag_name&&(q+=M.tag_name),M.attr_class)for(var F of(M.attr_class.sort(),M.attr_class))q+="."+F.replace(/"/g,"");var J=je({},M.text?{text:M.text}:{},{"nth-child":(L=M.nth_child)!==null&&L!==void 0?L: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),te={};return Dd(J).sort(((W,se)=>W[0].localeCompare(se[0]))).forEach((W=>{var se=W[1];return te[Zb(W[0].toString())]=Zb(se.toString())})),(q+=":")+Dd(te).map((W=>W[0]+'="'+W[1]+'"')).join("")})).join(";")})((function(A){return A.map((M=>{var L,B,q={text:(L=M.$el_text)==null?void 0:L.slice(0,400),tag_name:M.tag_name,href:(B=M.attr__href)==null?void 0:B.slice(0,2048),attr_class:J3(M),attr_id:M.attr__id,nth_child:M.nth_child,nth_of_type:M.nth_of_type,attributes:{}};return Dd(M).filter((F=>F[0].indexOf("attr__")===0)).forEach((F=>q.attributes[F[0]]=F[1])),q}))})(x)))},(n=g[0])!=null&&n.$el_text?{$el_text:(r=g[0])==null?void 0:r.$el_text}:{},R&&o.type==="click"?{$external_click_url:R}:{},b)}}var Cl=cs("[ExceptionAutocapture]"),g1=()=>{},PN=cs("[TracingHeaders]"),Gr=cs("[Web Vitals]"),_1=9e5,y1="disabled",b1="lazy_loading",El="awaiting_config",ku="missing_config";cs("[SessionRecording]"),cs("[SessionRecording]");var Ev="[SessionRecording]",On=cs(Ev),BN=cs("[Heatmaps]");function fm(e){return as(e)&&"clientX"in e&&"clientY"in e&&Ws(e.clientX)&&Ws(e.clientY)}var pm=cs("[Product Tours]"),mm=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(Qv))},HN=["$set_once","$set"],cn=cs("[SiteApps]"),S1="Error while initializing PostHog app with config id ";function Ga(e,t,n){if(at(e))return!1;switch(n){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class zN{constructor(t){this.Hn=new lg,this.Un=(n,r)=>this.zn(n,r)&&this.Vn(n,r)&&this.Wn(n,r)&&this.Zn(n,r),this.zn=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=t,this.Gn=new Set,this.Qn=new Set}init(){var t,n;Te((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((r,o)=>{this.on(r,o)}))}register(t){var n,r;if(!Te((n=this._instance)==null?void 0:n._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,n){var r;n!=null&&t.length!=0&&(this.Gn.has(t)||this.Gn.has(n.event))&&this.Qn&&((r=this.Qn)==null?void 0:r.size)>0&&this.Qn.forEach((o=>{this.Jn(n,o)&&this.Hn.emit("actionCaptured",o.name)}))}Kn(t){this.onAction("actionCaptured",(n=>t(n)))}Jn(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Un(t,r))return!0;return!1}onAction(t,n){return this.Hn.on(t,n)}Vn(t,n){if(n!=null&&n.url){var r,o=t==null||(r=t.properties)==null?void 0:r.$current_url;if(!o||typeof o!="string"||!Ga(o,n.url,n.url_matching||"contains"))return!1}return!0}Wn(t,n){return!!this.Yn(t,n)&&!!this.Xn(t,n)&&!!this.ts(t,n)}Yn(t,n){var r;if(n==null||!n.href)return!0;var o=this.es(t);if(o.length>0)return o.some((l=>Ga(l.href,n.href,n.href_matching||"exact")));var c,f=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!f&&Ga((c=f.match(/(?::|")href="(.*?)"/))?c[1]:"",n.href,n.href_matching||"exact")}Xn(t,n){var r;if(n==null||!n.text)return!0;var o=this.es(t);if(o.length>0)return o.some((m=>Ga(m.text,n.text,n.text_matching||"exact")||Ga(m.$el_text,n.text,n.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;!at(y=S.exec(m));)v.includes(y[1])||v.push(y[1]);return v})(d),f=n.text,l=n.text_matching||"exact",c.some((m=>Ga(m,f,l))))}ts(t,n){var r,o;if(n==null||!n.selector)return!0;var c=t==null||(r=t.properties)==null?void 0:r.$element_selectors;if(c!=null&&c.includes(n.selector))return!0;var f=(t==null||(o=t.properties)==null?void 0:o.$elements_chain)||"";if(n.selector_regex&&f)try{return new RegExp(n.selector_regex).test(f)}catch{return!1}return!1}es(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}Zn(t,n){return n==null||!n.properties||n.properties.length===0||$C(n.properties.reduce(((r,o)=>{var c=nt(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 UN{constructor(t){var n;this.rs=[],this._instance=t,this.ns=new Map,this.ss=new Map,this.os=new Map,(n=this._instance)==null||n.onSessionId==null||n.onSessionId((r=>this.ls(r)))}us(t,n){return!!t&&$C(t.propertyFilters,n==null?void 0:n.properties)}hs(t,n){var r=new Map;return t.forEach((o=>{var c;(c=o.conditions)==null||(c=c[n])==null||(c=c.values)==null||c.forEach((f=>{if(f!=null&&f.name){var l=r.get(f.name)||[];l.push(o.id),r.set(f.name,l)}}))})),r}ds(t,n,r){var o=(r===yl.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,n)}))}register(t){var n;Te((n=this._instance)==null?void 0:n._addCaptureHook)||(this.vs(t),this.fs(t))}fs(t){var n=t.filter((r=>{var o,c;return((o=r.conditions)==null?void 0:o.actions)&&((c=r.conditions)==null||(c=c.actions)==null||(c=c.values)==null?void 0:c.length)>0}));n.length!==0&&(this.ps==null&&(this.ps=new zN(this._instance),this.ps.init(),this.ps.Kn((r=>{this.onAction(r)}))),n.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 n,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||((n=this._instance)==null||n._addCaptureHook(((c,f)=>{this.onEvent(c,f)})),this.ns=this.hs(t,yl.Activation),this.ss=this.hs(t,yl.Cancellation))}onEvent(t,n){var r,o,c=this.gs(),f=(n==null||(r=n.properties)==null?void 0:r.$survey_id)||(n==null||(o=n.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,n,yl.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:n,items:this.ns.get(t)});var m=this.ds(t,n,yl.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 n=this.ks();n.includes(t)||(this.Ss([...n,t]),this.Cs())}bs(t){var n=new Set(t);this.rs=this.rs.filter((c=>!n.has(c)));var r=this.Ms(),o=r.filter((c=>!n.has(c)));o.length!==r.length&&(this.Ss(o),o.length===0&&this.Is())}Ms(){var t,n=this.Ts();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}ks(){var t,n,r=this.Ms();if(r.length===0)return[];var o=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.Es()],c=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return c&&o===c?r:[]}Cs(){var t,n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();n&&this.Rs(n)}Is(){this.Ps()}ls(t){var n,r=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this.Es()];r&&r!==t&&(this.Ms().length>0&&this.Ss([]),this.Is())}getActivatedIds(){return[...new Set([...this.ks(),...this.rs])].filter((t=>!this.Os(t)))}reset(){this.rs=[],this.Ms().length>0&&this.Ss([]),this.Is()}getEventToItemsMap(){return this.ns}Fs(){return this.ps}}class qN extends UN{constructor(t){super(t)}Ts(){return lv}Es(){return Od}As(){return qn.SHOWN}cs(t){var n;(n=this._instance)==null||n.getSurveys(t)}ws(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}gs(){return qt}Ss(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[lv]:t})}Rs(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Od]:t})}Ps(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(Od)}Os(){return!1}ys(t,n){var r;this.cs((c=>{r=c.find((f=>f.id===n))}));var o=!r||(function(c){var f;return LC(c)&&!((f=c.conditions)==null||(f=f.events)==null||!f.repeatedActivation)||c.schedule==="always"})(r);return o?t===qn.SHOWN?"consume":"ignore":t===qn.SHOWN?"persist":t===qn.DISMISSED||t===qn.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var ju="SDK is not enabled or survey functionality is not yet loaded",w1="Disabled. Not loading surveys.",FN=me!=null&&me.location?ah(me.location.hash,"__posthog")||ah(location.hash,"state"):null,x1="_postHogToolbarParams",C1=cs("[Toolbar]"),Rs=cs("[FeatureFlags]"),Kr=cs("[FeatureFlags]",{debugEnabled:!0}),vm=`" failed. Feature flags didn't load in time.`,E1=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},k1=e=>{var t={};for(var n of Dd(e||{})){var r=n[1];r&&(t[n[0]]=r)}return t},un=cs("[Error tracking]"),j1="Refusing to render web experiment since the viewer is a likely bot",VN={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>ch(t,e),not_regex:(e,t)=>!ch(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class Xs{get Te(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((o=>{Xs.$s("retrieved web experiments from the server"),n.Ls=new Map,o.forEach((c=>{if(c.feature_flag_key){var f;n.Ls&&(Xs.$s("setting flag key ",c.feature_flag_key," to web experiment ",c),(f=n.Ls)==null||f.set(c.feature_flag_key,c));var l=n._instance.getFeatureFlag(c.feature_flag_key);Yt(l)&&c.variants[l]&&n.Ds(c.name,l,c.variants[l].transforms)}else if(c.variants)for(var d in c.variants){var m=c.variants[d];Xs.Ns(m,n._instance)&&n.Ds(c.name,d,m.transforms)}}))}),r)},this._instance=t,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Xs.$s(j1);else if(!this.Te.disable_web_experiments){if(at(this.Ls))return this.Ls=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Xs.$s("applying feature flags",t),t.forEach((n=>{var r;if(this.Ls&&(r=this.Ls)!=null&&r.has(n)){var o,c=this._instance.getFeatureFlag(n),f=(o=this.Ls)==null?void 0:o.get(n);c&&f!=null&&f.variants[c]&&this.Ds(f.name,c,f.variants[c].transforms)}}))}}previewWebExperiment(){var t=Xs.getWindowLocation();if(t!=null&&t.search){var n=vo(t==null?void 0:t.search,"__experiment_id"),r=vo(t==null?void 0:t.search,"__experiment_variant");n&&r&&(Xs.$s("previewing web experiments "+n+" && "+r),this.getWebExperiments((o=>{this.qs(parseInt(n),r,o)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this.Te.disable_web_experiments&&!r)return t([]);var o=this._instance.get_property("$web_experiments");if(o&&!n)return t(o);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Te.token),method:"GET",timestampMode:"query",callback:c=>t(c.statusCode===200&&c.json&&c.json.experiments||[])})}qs(t,n,r){var o=r.filter((c=>c.id===t));o&&o.length>0&&(Xs.$s("Previewing web experiment ["+o[0].name+"] with variant ["+n+"]"),this.Ds(o[0].name,n,o[0].variants[n].transforms))}static Ns(t,n){return!at(t.conditions)&&Xs.js(t,n)&&Xs.Bs(t)}static js(t,n){var r;if(at(t.conditions)||at((r=t.conditions)==null?void 0:r.url))return!0;var o=Xs.getWindowLocation();if(o){var c,f,l,d=Qx(n,o.href);return(c=t.conditions)==null||!c.url||VN[(f=(l=t.conditions)==null?void 0:l.urlMatchType)!==null&&f!==void 0?f:"icontains"](t.conditions.url,d)}return!1}static getWindowLocation(){return me==null?void 0:me.location}static Bs(t){var n;if(at(t.conditions)||at((n=t.conditions)==null?void 0:n.utm))return!0;var r=pC();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 n=arguments.length,r=new Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];Ne.info("[WebExperiments] "+t,r)}Ds(t,n,r){this._is_bot()?Xs.$s(j1):n!=="control"?r.forEach((o=>{if(o.selector){var c;Xs.$s("applying transform of variant "+n+" 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)}))}})):Xs.$s("Control variants leave the page unmodified.")}_is_bot(){return ii&&this._instance?MC(ii,this.Te.custom_blocked_useragents):void 0}}var qi=cs("[Conversations]"),Yr="Conversations not available yet.",A1="console",xh={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=[],me&&hs(me,"online",this.Ks)}destroy(){me==null||me.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,Rs.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||(Rs.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gs=!0),t!=null&&t.length?t.filter((n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||Rs.error("Invalid evaluation context found:",n,"Expected non-empty string"),r})):[]}no(){return this.io().length>0}so(){var e=this.Te.flag_keys;if(!Te(e)){if(nt(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||Rs.error("Invalid flag key found:",t,"Expected non-empty string"),n}));Rs.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,n=this._instance.config,r=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(r).length){var o,c,f=(o=(c=n.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,n){var r,o,c=n!=null&&n.merge&&(r=this.Xs(na))!==null&&r!==void 0?r:{},f=n!=null&&n.merge&&(o=this.Xs(Md))!==null&&o!==void 0?o:{},l=je({},c,e),d=je({},f,t),m={};for(var y of Object.entries(l)){var v=y[0],S=y[1];m[v]={key:v,enabled:Eb(S),variant:kb(S),reason:void 0,metadata:Te(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(rv),t=this.Xs(Pn),n=this.Xs(Qa);if(!n&&!t)return e||{};var r=es({},e||{}),o=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var c of o){var f,l,d=r[c],m=t==null?void 0:t[c],y=Te(m)?(f=d==null?void 0:d.enabled)!==null&&f!==void 0&&f:!!m,v=Te(m)?d.variant:typeof m=="string"?m:void 0,S=n==null?void 0:n[c],w=je({},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=je({},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||(Rs.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.Hs=!0),r}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((n=>{var r=e[n];return{key:n,enabled:Eb(r),variant:kb(r),payload:Cb(t[n])}}))}getFlagVariants(){var e=this.Xs(na),t=this.Xs(Pn);if(!t)return e||{};for(var n=es({},e),r=Object.keys(t),o=0;r.length>o;o++)n[r[o]]=t[r[o]];return this.Hs||(Rs.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Hs=!0),n}getFlagPayloads(){var e=this.Xs(Md),t=this.Xs(Qa);if(!t)return e||{};for(var n=es({},e||{}),r=Object.keys(t),o=0;r.length>o;o++)n[r[o]]=t[r[o]];return this.Hs||(Rs.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.Hs=!0),n}reloadFeatureFlags(){this.Vs||this.Te.advanced_disable_feature_flags||this.Ys()||this.oo||(this._instance.en.emit("featureFlagsReloading",!0),this.oo=setTimeout((()=>{this.ao()}),5))}lo(){clearTimeout(this.oo),this.oo=void 0}ensureFlagsLoaded(){this.Us||this.zs||this.oo||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Vs=e}ao(e){var t;if(this.lo(),!this._instance.Ur()&&!this.Ys())if(this.zs)this.Ws=!0;else{var n=this.Te.token,r=this.Xs(Gl),o={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:je({},((t=this.mi)==null?void 0:t.get_initial_props())||{},this.Xs(ea)||{},{$lib:Pt.LIB_NAME,$lib_version:Pt.LIB_VERSION}),group_properties:this.Xs(ta),timezone:bC()};ni(r)||Te(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();Te(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:si.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({[uv]:w}),x?Rs.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 hC(this.Js,3)}uo(e){this.Js=fC(e,this.Js,3,(()=>Rs.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.Zs)if(this.Us||this.getFlags()&&this.getFlags().length>0){if(!this.ro()){var r=this.getFeatureFlagResult(e,t);return(n=r==null?void 0:r.variant)!==null&&n!==void 0?n:r==null?void 0:r.enabled}}else Rs.warn('getFeatureFlag for key "'+e+vm)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.Zs)if(this.Us||this.getFlags()&&this.getFlags().length>0){if(!this.ro()){var n=this.getFlagVariants(),r=e in n,o=n[e],c=this.getFlagPayloads()[e],f=String(o),l=this.Xs(av)||void 0,d=this.Xs(Kl)||void 0,m=this.Xs(Hl)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var y,v=this._instance.get_session_id(),S=this.Xs(cv);v&&v!==S&&(m={},(y=this.mi)==null||y.register({[Hl]:m,[cv]:v}))}if((t.send_event||!("send_event"in t))&&(!(e in m)||!m[e].includes(f))){var w,R,x,g,b,p,_,k,j,C,T;nt(m[e])?m[e].push(f):m[e]=[f],(w=this.mi)==null||w.register({[Hl]:m});var A=this.getFeatureFlagDetails(e),M=[...(R=this.Xs(uv))!==null&&R!==void 0?R:[]];Te(o)&&M.push("flag_missing");var L={$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};Te(A==null||(b=A.metadata)==null?void 0:b.has_experiment)||(L.$feature_flag_has_experiment=A.metadata.has_experiment),Te(A==null||(p=A.metadata)==null?void 0:p.version)||(L.$feature_flag_version=A.metadata.version);var B,q=(_=A==null||(k=A.reason)==null?void 0:k.description)!==null&&_!==void 0?_:A==null||(j=A.reason)==null?void 0:j.code;q&&(L.$feature_flag_reason=q),A!=null&&(C=A.metadata)!=null&&C.id&&(L.$feature_flag_id=A.metadata.id),Te(A==null?void 0:A.original_variant)&&Te(A==null?void 0:A.original_enabled)||(L.$feature_flag_original_response=Te(A.original_variant)?A.original_enabled:A.original_variant),A!=null&&(T=A.metadata)!=null&&T.original_payload&&(L.$feature_flag_original_payload=A==null||(B=A.metadata)==null?void 0:B.original_payload),M.length&&(L.$feature_flag_error=M.join(",")),this._instance.capture("$feature_flag_called",L)}if(r)return{key:e,enabled:!!o,variant:typeof o=="string"?o:void 0,payload:Cb(c)}}}else Rs.warn('getFeatureFlagResult for key "'+e+vm)}getRemoteConfigPayload(e,t){var n=this.Te.token,r={distinct_id:this._instance.get_distinct_id(),token:n,person_properties:{$lib:Pt.LIB_NAME,$lib_version:Pt.LIB_VERSION}};this.no()&&(r.evaluation_contexts=this.io());var o=this.so();Te(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:si.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 Rs.warn('isFeatureEnabled for key "'+e+vm),t.defaultValue;var n=this.getFeatureFlag(e,t);return Te(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){if(this.mi){this.Us=!0;var r=this.getFlagVariants(),o=this.getFlagPayloads(),c=this.getFlagsWithDetails();(function(f,l,d,m,y,v){d===void 0&&(d={}),m===void 0&&(m={}),y===void 0&&(y={});var S=(A=>{var M=A.flags;return M?(A.featureFlags=Object.fromEntries(Object.keys(M).map((L=>{var B;return[L,(B=M[L].variant)!==null&&B!==void 0?B:M[L].enabled]}))),A.featureFlagPayloads=Object.fromEntries(Object.keys(M).filter((L=>M[L].enabled)).filter((L=>{var B;return(B=M[L].metadata)==null?void 0:B.payload})).map((L=>{var B;return[L,(B=M[L].metadata)==null?void 0:B.payload]})))):A.featureFlags&&Rs.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),A})(f),w=S.flags,R=S.featureFlags,x=S.featureFlagPayloads;if(R){var g=f.requestId,b=f.evaluatedAt;if(nt(R)){Rs.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({[Nd]:R,[na]:p,[Jd]:!1})}else{var k=R,j=x,C=w;if(v!=null&&v.partialResponse)k=je({},d,k),j=je({},m,j),C=je({},y,C);else if(f.errorsWhileComputingFlags)if(w){var T=new Set(Object.keys(w).filter((A=>{var M;return!((M=w[A])!=null&&M.failed)})));k=je({},d,Object.fromEntries(Object.entries(k).filter((A=>T.has(A[0]))))),j=je({},m,Object.fromEntries(Object.entries(j||{}).filter((A=>T.has(A[0]))))),C=je({},y,Object.fromEntries(Object.entries(C||{}).filter((A=>T.has(A[0])))))}else k=je({},d,k),j=je({},m,j),C=je({},y,C);l&&l.register(je({[Nd]:Object.keys(k1(k)),[na]:k||{},[Md]:j||{},[rv]:C||{},[Jd]:f.minimalFlagCalledEvents===!0},g?{[av]:g}:{},b?{[Kl]:b}:{}))}}})(e,this.mi,r,o,c,n),t||(this.Qs=!1),this.ho(t)}}override(e,t){t===void 0&&(t=!1),Rs.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.mi)return Rs.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.mi.unregister(Pn),this.mi.unregister(Qa),this.ho(),Kr.info("All overrides cleared");if(nt(e)){var t=E1(e);return this.mi.register({[Pn]:t}),this.ho(),Kr.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,r=e;if(this.Hs=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this.mi.unregister(Pn),Kr.info("Flag overrides cleared");else if(r.flags){if(nt(r.flags)){var o=E1(r.flags);this.mi.register({[Pn]:o})}else this.mi.register({[Pn]:r.flags});Kr.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this.mi.unregister(Qa),Kr.info("Payload overrides cleared")):r.payloads&&(this.mi.register({[Qa]:r.payloads}),Kr.info("Payload overrides set",{payloads:r.payloads}))),void this.ho()}if(e&&typeof e=="object")return this.mi.register({[Pn]:e}),this.ho(),Kr.info("Flag overrides set",{flags:e});Rs.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Us){var t=this.do(),n=t.flags,r=t.flagVariants;try{e(n,r)}catch(o){Rs.error("Error while running feature flags callback",o)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r,o=(this.Xs(Dl)||[]).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),n&&(f.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",f),this.setPersonPropertiesForFlags(c,!1);var l=je({},this.getFlagVariants(),{[e]:t});(r=this.mi)==null||r.register({[Nd]:Object.keys(k1(l)),[na]:l}),this.ho()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this.Xs(Dl),o=n?"&"+n.map((c=>"stage="+c)).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Te.token+o),method:"GET",timestampMode:"query",callback:c=>{var f,l;if(c.json){var d=c.json.earlyAccessFeatures;return(f=this.mi)==null||f.unregister(Dl),(l=this.mi)==null||l.register({[Dl]:d}),e(d)}}})}do(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,r)=>(n[r]=t[r],n)),{})}}ho(e){var t=this.do(),n=t.flags,r=t.flagVariants;this.featureFlagEventHandlers.forEach((o=>{try{o(n,r,{errorsLoading:e})}catch(c){Rs.error("Error while running feature flags callback",c)}}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=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 n||(c[f]=o[f]));this._instance.register({[ea]:je({},n,c,r)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=je({},this.Xs(ea)||{});e.forEach((r=>{delete n[r]})),this._instance.register({[ea]:n}),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 n=this.Xs(ta)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((r=>{n[r]=je({},n[r],e[r]),delete e[r]})),this._instance.register({[ta]:je({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Xs(ta)||{};this._instance.register({[ta]:je({},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}}},WN={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===El||this.vo===ku?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=y1,this.fo=void 0,this._instance=e,!this._instance.sessionManager)throw On.error("started without valid sessionManager"),new Error(Ev+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===zn)throw new Error(Ev+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get po(){var e,t=!((e=this._instance.get_property(ra))==null||!e.enabled),n=!this.Te.disable_session_recording,r=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return me&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!this.po||(t=this.co)==null||!t.isStarted){var n=!Te(Object.assign)&&!Te(Array.from);this.po&&n?(this.mo(e),On.info("starting")):(this.vo=y1,this.stopRecording())}}mo(e){var t,n,r;this.po&&(this.vo!==El&&this.vo!==ku&&(this.vo=b1),Ue!=null&&(t=Ue.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Ue.__PosthogExtensions__)!=null&&n.initSessionRecording?this.yo(e):(r=Ue.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.bo,(o=>{if(o)return On.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(eg),(t=this.mi)==null||t.unregister(zx)}xo(e,t){if(at(e))return null;var n,r=Ws(e)?e:parseFloat(e);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(On.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}ko(e){if(this.mi){var t,n,r=this.mi,o=()=>{var c,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;at(m)&&this.wo();var y=f==null?void 0:f.minimumDurationMilliseconds;r.register({[ra]:je({cache_timestamp:Date.now(),enabled:!!f},f,{networkPayloadCapture:je({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:Te(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=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(o)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.ko(t),void this._o()):(this.ko(t),void this.startIfEnabledOrStop()):(this.vo===El&&(this.vo=ku,On.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t="log"),(n=this.co)!=null&&n.log?this.co.log(e,t):On.warn("log called before recorder was ready")}get bo(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(ra);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}So(){var e,t,n=this._instance.get_property(ra);if(!n)return!1;try{t=typeof n=="object"?n:JSON.parse(n)}catch(o){return On.warn("persisted remote config for session recording is invalid and will be ignored",o),!1}var r=(e=t.cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-r}yo(e){var t,n;if((t=Ue.__PosthogExtensions__)==null||!t.initSessionRecording)return On.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Yx]:!0});if(this.co||(this.co=(n=Ue.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.co._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.So())return this.vo===ku||this.vo===El?void 0:(this.vo=El,On.info("persisted remote config is stale, requesting fresh config before starting"),void new SC(this._instance).load());this.vo=b1,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({[qx]:!0}),(e=this.co)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.co||(t=this.mi)==null||t.register({[Ux]:!0}),(e=this.co)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.co||(n=this.mi)==null||n.register({[e==="url"?Fx:Vx]:!0}),(t=this.co)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.co)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.co)==null||!n.tryAddCustomEvent(e,t))}}},GN={autocapture:class{constructor(e){this.Co=!1,this.Mo=null,this.Io=!1,this.To=!1,this.instance=e,this.rageclicks=new v1(e.config.rageclick),this.Eo=null}initialize(){this.startIfEnabled()}get Te(){var e,t,n=as(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((r=>new RegExp(r))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((r=>new RegExp(r))),n}Ro(){if(this.isBrowserSupported()){if(me&&Le){var e=n=>{n=n||(me==null?void 0:me.event);try{this.Po(n)}catch(r){dm.error("Failed to capture event",r)}};if(hs(Le,"submit",e,{capture:!0}),hs(Le,"change",e,{capture:!0}),hs(Le,"click",e,{capture:!0}),this.Te.capture_copied_text){var t=n=>{n=n||(me==null?void 0:me.event);try{this.Po(n,um)}catch(r){dm.error("Failed to capture copy/cut event",r)}};hs(Le,"copy",t,{capture:!0}),hs(Le,"cut",t,{capture:!0})}}}else dm.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Co&&(this.Ro(),this.Co=!0)}onRemoteConfig(e){if(this.Io=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this.To=t.elementsChainAsString);var n=t.autocapture_opt_out;Qi(n)&&(this.instance.persistence&&this.instance.persistence.register({[Zm]:n}),this.Mo=n),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this.Eo=e}getElementSelectors(e){var t,n=[];return(t=this.Eo)==null||t.forEach((r=>{var o=Le==null?void 0:Le.querySelectorAll(r);o==null||o.forEach((c=>{e===c&&n.push(r)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[Zm],r=this.Mo,o=this.instance.Ur()&&!this.Io;if(ni(r)&&!Qi(n)&&!o)return!1;var c=(t=this.Mo)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!c}Po(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,r=Zp(e);tC(r)&&(r=r.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Wb(r,this.instance.config.rageclick)&&this.Po(e,"$rageclick");var o=t===um;if(r&&(function(v,S,w,R,x,g){var b;if(!me||rg(v)||w!=null&&w.url_allowlist&&!qb(w.url_allowlist,g)||w!=null&&w.url_ignorelist&&qb(w.url_ignorelist,g))return!1;if(w!=null&&w.dom_event_allowlist){var p=w.dom_event_allowlist;if(p&&!p.some((A=>S.type===A)))return!1}var _=oC(v,R),k=_.parentIsUsefulElement,j=_.targetElementList;if(!(function(A,M){var L=M==null?void 0:M.element_allowlist;if(Te(L))return!0;var B,q=function(J){if(L.some((te=>J.tagName.toLowerCase()===te)))return{v:!0}};for(var F of A)if(B=q(F))return B.v;return!1})(j,w)||!vv(j,w==null?void 0:w.css_selector_allowlist)||vv(j,(b=w==null?void 0:w.css_selector_ignorelist)!==null&&b!==void 0?b:V3))return!1;try{var C=me.getComputedStyle(v);if(C&&C.getPropertyValue("cursor")==="pointer"&&S.type==="click")return!0}catch{}var T=v.tagName.toLowerCase();switch(T){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&&(ng.indexOf(T)>-1||v.getAttribute("contenteditable")==="true")}})(r,e,this.Te,o,o?["copy","cut"]:void 0,this.instance)){var c=IN(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===um){var d,m=nC(me==null||(d=me.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 Ai(Le==null?void 0:Le.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.Oo=(me==null||(t=me.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Ne.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Fo&&this.Fo(),this.Fo=void 0,Ne.info("History API monitoring stopped")}monitorHistoryChanges(){me&&me.history&&(this.Ao("pushState"),this.Ao("replaceState"),this.$o())}Ao(e){var t;if(me&&((t=me.history[e])==null||!t.__posthog_wrapped__)){var n=this;(function(r,o,c){try{if(!(o in r))return g1;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 Ai(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];Ai(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 g1}})(me.history,e,(r=>function(o,c,f){r.call(this,o,c,f),n.Lo(e)}))}}Lo(e){try{var t,n=me==null||(t=me.location)==null?void 0:t.pathname;if(!n)return;n!==this.Oo&&this.isEnabled&&this._instance.capture(eo,{navigation_type:e}),this.Oo=n}catch(r){Ne.error("Error capturing "+e+" pageview",r)}}$o(){if(!this.Fo){var e=()=>{this.Lo("popstate")};hs(me,"popstate",e),this.Fo=()=>{me&&me.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[Qm]),this.rageclicks=new v1(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return as(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(e=this.Te.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return at(this.Te.capture_heatmaps)?at(this.Te.enable_heatmaps)?this.Do:this.Te.enable_heatmaps:this.Te.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Co)return;BN.info("starting..."),this.qo(),this.xe()}else{var e;clearInterval((e=this.No)!==null&&e!==void 0?e:void 0),this.jo(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Qm]:n}),this.Do=n,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}Bo(e){fm(e.originalEvent)&&this.pe(e.originalEvent,"deadclick")}xe(){this.No&&clearInterval(this.No),this.No=(Le==null?void 0:Le.visibilityState)==="visible"?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}qo(){me&&Le&&(this.Ho=this.oi.bind(this),hs(me,sh,this.Ho),this.Uo=e=>this.pe(e||(me==null?void 0:me.event)),hs(Le,"click",this.Uo,{capture:!0}),this.zo=e=>this.Vo(e||(me==null?void 0:me.event)),hs(Le,"mousemove",this.zo,{capture:!0}),this.Wo=new Qb(this.instance,Z3,this.Bo.bind(this)),this.Wo.startIfEnabledOrStop(),this.Zo=this.xe.bind(this),hs(Le,th,this.Zo),this.Co=!0)}jo(){var e;me&&Le&&(this.Ho&&me.removeEventListener(sh,this.Ho),this.Uo&&Le.removeEventListener("click",this.Uo,{capture:!0}),this.zo&&Le.removeEventListener("mousemove",this.zo,{capture:!0}),this.Zo&&Le.removeEventListener(th,this.Zo),clearTimeout(this.Go),(e=this.Wo)==null||e.stop(),this.Co=!1)}Qo(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),o=this.instance.scrollManager.scrollElement(),c=(function(f,l,d){for(var m=f;m&&wr(m)&&!Ri(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:me)==null?void 0:v.getComputedStyle(m).position}catch{return!1}if(Ye(l,y))return!0;m=rC(m)}return!1})(Zp(e),["fixed","sticky"],o);return{x:e.clientX+(c?0:r),y:e.clientY+(c?0:n),target_fixed:c,type:t}}pe(e,t){var n;if(t===void 0&&(t="click"),!Ub(e.target)&&fm(e)){var r=this.Qo(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&Wb(Zp(e),this.instance.config.rageclick)&&this.Wt(je({},r,{type:"rageclick"})),this.Wt(r)}}Vo(e){!Ub(e.target)&&fm(e)&&(clearTimeout(this.Go),this.Go=setTimeout((()=>{this.Wt(this.Qo(e,"mousemove"))}),500))}Wt(e){if(me){var t=this.Te.disable_capture_url_hashes?Sr(me.location.href):me.location.href,n=this.Te.custom_personal_data_properties,r=this.Te.mask_personal_data_properties?[...go,...n||[]]:[],o=Xl(t,r,Jl);this.R=this.R||{},this.R[o]||(this.R[o]=[]),this.R[o].push(e)}}oi(){this.R&&!_r(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Qb,webVitalsAutocapture:class{constructor(e){var t;this.Do=!1,this.Co=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Jo=()=>{clearTimeout(this.Ko),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((n,r)=>je({},n,{["$web_vitals_"+r.name+"_event"]:je({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Yo=n=>{var r;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Xo();if(!Te(o))if(at(n==null?void 0:n.name)||at(n==null?void 0:n.value))Gr.error("Invalid metric received",n);else if(!this.ta||this.ta>n.value){this.R.url!==o&&(this.Jo(),this.Ko=setTimeout(this.Jo,this.flushToCaptureTimeoutMs)),Te(this.R.url)&&(this.R.url=o),this.R.firstMetricTimestamp=Te(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var c=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0),f=je({},n,{$current_url:o,timestamp:Date.now()});Te(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,n)},this.ea=()=>{if(!this.Co){var n,r,o,c,f=Ue.__PosthogExtensions__;if(!Te(f)&&!Te(f.postHogWebVitalsCallbacks)){var l=f.postHogWebVitalsCallbacks;n=l.onLCP,r=l.onCLS,o=l.onFCP,c=l.onINP}n&&r&&o&&c?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.Yo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Yo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&o(this.Yo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&c(this.Yo.bind(this)),this.Co=!0):Gr.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Do=!((t=this._instance.persistence)==null||!t.props[iv]),this.startIfEnabled()}get ra(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=as(this.ra)?(e=this.ra)==null?void 0:e.web_vitals_allowed_metrics:void 0;return at(n)?((t=this._instance.persistence)==null?void 0:t.props[nv])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(as(this.ra)?this.ra.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=as(this.ra)?this.ra.web_vitals_attribution:void 0;return e!=null&&e}get ta(){var e=as(this.ra)&&Ws(this.ra.__web_vitals_max_value)?this.ra.__web_vitals_max_value:_1;return e>0&&6e4>=e?_1:e}get isEnabled(){var e=Cs==null?void 0:Cs.protocol;if(e!=="http:"&&e!=="https:")return Gr.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=as(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 n=as(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=as(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[iv]:n}),this._instance.persistence.register({[nv]:r})),this.Do=n,this.startIfEnabled()}}}tr(e){var t,n;(t=Ue.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(n=Ue.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(r=>{r?Gr.error("failed to load script",r):e()}))}Xo(){var e=me?this._instance.config.disable_capture_url_hashes?Sr(me.location.href):me.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...go,...t||[]]:[];return Xl(e,n,Jl)}Gr.error("Could not determine current URL")}}},KN={exceptionObserver:class{constructor(e){var t;this.ea=()=>{var n;if(me&&this.isEnabled&&(n=Ue.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var r=Ue.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=Ue.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,c=Ue.__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){Cl.error("failed to start",f),this.oa()}}},this._instance=e,this.aa=!((t=this._instance.persistence)==null||!t.props[ev]),this.la=new GT(je({},(function(n){var r,o,c,f;return n===void 0&&(n={}),{refillRate:(r=(o=n.exceptionRateLimiterRefillRate)!==null&&o!==void 0?o:n.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(c=(f=n.exceptionRateLimiterBucketSize)!==null&&f!==void 0?f:n.__exceptionRateLimiterBucketSize)!==null&&c!==void 0?c:10}})(this._instance.config.error_tracking),{refillInterval:1e4,it:Cl})),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 as(e)?t=je({},t,e):(Te(e)?this.aa:e)&&(t=je({},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?(Cl.info("enabled"),this.oa(),this.tr(this.ea)):this.oa()}tr(e){var t,n;(t=Ue.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=Ue.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return Cl.error("failed to load script",r);e()}))}oa(){var e,t,n;(e=this.ia)==null||e.call(this),this.ia=void 0,(t=this.na)==null||t.call(this),this.na=void 0,(n=this.sa)==null||n.call(this),this.sa=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.aa=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[ev]:this.aa}),this.Te=this.ua(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ua()}captureException(e){var t,n,r,o=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.la.consumeRateLimit(o)?Cl.info("Skipping exception capture because of client rate limiting.",{exception:o}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.ha=[],this.da=new u3([new _3,new j3,new b3,new y3,new E3,new C3,new w3,new k3],(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=Pb.test(S)?S.replace(Pb,"$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 je({},p,{filename:p.filename||(_=b,_[_.length-1]||{}).filename,function:p.function||mo});var _}))})(m)}})("web:javascript",p3,g3)),this._instance=e,this.ha=(t=(n=this._instance.persistence)==null?void 0:n.get_property(tv))!==null&&t!==void 0?t:[],this.ca=Xd(this.va()),this.fa=new R3(this.ca)}onConfigChange(){this.ca=Xd(this.va()),this.fa.setConfig(this.ca)}onRemoteConfig(e){var t,n,r;if(e.ok){var o=e.config;if("errorTracking"in o){var c=(t=(n=o.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],f=(r=o.errorTracking)==null?void 0:r.captureExtensionExceptions;this.ha=c,this._instance.persistence&&this._instance.persistence.register({[tv]:this.ha,[sv]:f})}}}get pa(){var e,t=!!this._instance.get_property(sv),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.da.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.ca.enabled)try{if(!Yt(e)||e.trim().length===0)return void un.warn("Ignoring exception step because message must be a non-empty string");var n=(function(c){if(!c)return{sanitizedProperties:{},droppedKeys:[]};var f=[];return{sanitizedProperties:Object.keys(c).reduce(((l,d)=>A3.has(d)?(f.push(d),l):(l[d]=c[d],l)),{}),droppedKeys:f}})(this.ga(t)),r=n.sanitizedProperties,o=n.droppedKeys;o.length>0&&un.warn("Ignoring reserved exception step fields",{droppedKeys:o}),this.fa.add(je({[Kd]:e,[Yd]: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 n=this.ca.enabled&&at(e.$exception_steps)?this.xa(e):e,r=typeof(c=globalThis._posthogReleaseId)=="string"&&c.length>0?c:void 0;r&&(n.$release_id=r);try{var o=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",Pn:!0});return o&&this.fa.clear(),o}catch(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:je({},e,{$exception_steps:t})}catch(n){return un.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}ba(e){this.ca.enabled&&this.fa.add({[Kd]:e,[Yd]:new Date().toISOString()})}ga(e){return as(e)?je({},e):{}}va(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}ya(e){if(e.length===0)return!1;try{var t=e.reduce(((n,r)=>{var o=r.type,c=r.value;return Yt(o)&&o.length>0&&n.$exception_types.push(o),Yt(c)&&c.length>0&&n.$exception_values.push(c),n}),{$exception_types:[],$exception_values:[]});return this.ha.some((n=>{var r=n.values.map((o=>{var c=DC[o.operator],f=t[o.key];if(!c||!f)return!1;var l=nt(o.value)?o.value:[o.value];return l.length>0&&c(l,f)}));return n.type==="OR"?r.some(Boolean):r.every(Boolean)}))}catch(n){return un.warn("Failed to evaluate suppression rules. Capturing the exception.",n),!1}}_a(e){return e.flatMap((t=>{var n,r;return(n=(r=t.stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}wa(e){if(e.length>0){var t,n,r,o,c=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],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!at(e)&&nt(e)}}},YN=je({productTours:class{get mi(){return this._instance.persistence}constructor(e){this.ka=null,this.Sa=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var n,r;if(this.mi&&this.mi.register({[Qv]:!!t.productTours}),!mm(this._instance))return!this.ka&&at((n=this.mi)==null?void 0:n.props[$l])||pm.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&&mm(this._instance)&&this.tr((()=>this.Ca()))}tr(e){var t,n;(t=Ue.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Ue.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(r=>{r?pm.error("Could not load product tours script",r):e()}))}Ca(){var e;!this.ka&&(e=Ue.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.ka=Ue.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!nt(this.Sa)||t){var n=this.mi;if(n){var r=n.props[$l];if(nt(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(mm(this._instance)){var c=o.statusCode;if(c!==200||!o.json){var f="Product Tours API could not be loaded, status: "+c;return pm.error(f),void e([],{isLoaded:!1,error:f})}var l=nt(o.json.product_tours)?o.json.product_tours:[];this.Sa=l,n&&n.register({[$l]:l}),e(l,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Sa,{isLoaded:!0})}getActiveProductTours(e){at(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($l)}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)}}},xh),XN={siteApps:class{constructor(e){this.Ma=0,this._instance=e,this.Ia=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ta(e,t){if(t){var n=this.globalsForEvent(t);this.Ia.push(n),this.Ia.length>1e3&&(this.Ia=this.Ia.slice(10))}}get siteAppLoaders(){var e;return(e=Ue._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Ta.bind(this));this.Ea=()=>{e(),this.Ia=[],this.Ea=void 0}}}globalsForEvent(e){var t,n,r,o,c,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:je({},ox(e,HN),{properties:je({},e.properties,R?{$set:je({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},R)}:{},w?{$set_once:je({},(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,n=(t=e.tagName)==null?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(cn.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(cn.error("prepare_external_dependency_script returned null"),null):e}Pa(){var e,t,n,r,o,c,f,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var d=Le==null?void 0:Le.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=>!ni(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,(n=d.Document)==null?void 0:n.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 j=x(_);return _.length&&!j.length?void 0:b.apply(this,j)}))})),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 n=this.Pa();try{var r=e(n);return t&&n(),r}catch(o){throw n(),o}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var 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&&n()};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(S1+e.id,f),o(!1)}if(r&&t.loaded)try{n()}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 n of e)this.setupSiteApp(n)}La(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),r=function(c){try{t.Aa((()=>c.processEvent==null?void 0:c.processEvent(n)))}catch(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,n,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((n=this.Ea)==null||n.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;Ue["__$$ph_site_app_"+m]=o._instance,(d=Ue.__PosthogExtensions__)==null||d.loadSiteApp==null||d.loadSiteApp(o._instance,y,(v=>{if(v)return cn.error(S1+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.')}}}},JN={tracingHeaders:class{constructor(e){this.Da=void 0,this.Na=void 0,this.qa=void 0,this.ea=()=>{var t,n,r=this.ja();r?(Te(this.Da)&&(this.Da=(t=Ue.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Te(this.Na)&&(this.Na=(n=Ue.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.oa()},this._instance=e}initialize(){this.startIfEnabledOrStop()}tr(e){var t,n;(t=Ue.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=Ue.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return PN.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 nt(e)?(nt(this.qa)?this.qa.splice(0,this.qa.length,...e):this.qa=[...e],e.length>0?this.qa:void 0):(nt(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()}}},ZN=je({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(at(t))return qt.warn("Flags not loaded yet. Not loading surveys.");var n=nt(t);this.Ha=n?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=[],n=0;n<localStorage.length;n++){var r=localStorage.key(n);(r!=null&&r.startsWith(IC)||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(w1);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())qt.info("Not loading surveys in cookieless mode without consent.");else{var e=Ue==null?void 0:Ue.__PosthogExtensions__;if(e){if(!Te(this.Ha)||this.Te.advanced_enable_surveys){var t=this.Ha||this.Te.advanced_enable_surveys;this.Ua=!0;try{var n=e.generateSurveys;if(n)return void this.Za(n,t);var r=e.loadExternalDependency;if(!r)return void this.Ga(tg);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 qN(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(w1),e([]);var n,r=this._instance.get_property(ov);if(r&&!t)return e(r,{isLoaded:!0}),void(this.Ja()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.Va?this.Va.then((o=>e(o.surveys,o.context))):(typeof Promise<"u"&&(this.Va=new Promise((o=>{n=o}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Te.token),method:"GET",timestampMode:"query",timeout:this.Te.surveys_request_timeout_ms,callback:o=>{var c;this.Va=null;var 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(n==null||n({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)&&(LC(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({[ov]:y,[Zd]:Date.now()});var S={isLoaded:!0};e(y,S),n==null||n({surveys:y,context:S})}}))}Ja(){return this.Ka()&&!this.Va&&!this.Ya()}Ka(){var e=this._instance.get_property(Zd);return Ws(e)&&Date.now()-e>3e5}Ya(){return Ws(this.Wa)&&3e5>Date.now()-this.Wa}markSurveyAsSeen(e,t){var n,r={id:e,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};PC(r);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Qa(e){for(var t of this.za)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){qt.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!at(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);qt.warn("init was not called")}Xa(e){var t=null;return this.getSurveys((n=>{var r;t=(r=n.find((o=>o.id===e)))!==null&&r!==void 0?r:null})),t}tl(e){if(at(this._surveyManager))return{eligible:!1,reason:ju};var t=typeof e=="string"?this.Xa(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}el(e){if(at(this._surveyManager))return{eligible:!1,reason:ju};var t=typeof e=="string"?this.Xa(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(at(this._surveyManager))return qt.warn("init was not called"),{visible:!1,disabledReason:ju};var t=this.el(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return at(this._surveyManager)?(qt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ju})):new Promise((n=>{this.getSurveys((r=>{var o,c=(o=r.find((l=>l.id===e)))!==null&&o!==void 0?o:null;if(c){var f=this.el(c);n({visible:f.eligible,disabledReason:f.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var r;if(at(this._surveyManager))qt.warn("init was not called");else{var o=typeof e=="string"?this.Xa(e):e;if(o!=null&&o.id)if(EN.includes(o.type)){var c=Le==null?void 0:Le.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,n),qt.info("Survey "+o.id+" rendered")}),1e3*o.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(o,c,n);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 n;if(at(this._surveyManager))qt.warn("init was not called");else{var r=this.Xa(e);if(r){var o=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(o=je({},r,{appearance:je({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==_v.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!==_v.Inline?this._surveyManager.handlePopoverSurvey(o,t):this.renderSurvey(o,t.selector,t.properties)}else qt.warn("Survey not found")}}cancelPendingSurvey(e){at(this._surveyManager)?qt.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}}},xh),QN={toolbar:class{constructor(e){this.instance=e}rl(e){Ue.ph_toolbar_state=e}il(){var e;return(e=Ue.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),Xx(this.instance.config)||!me||!Le)return!1;e=e??me.location,n=n??me.history;try{if(!t){try{me.localStorage.setItem("test","test"),me.localStorage.removeItem("test")}catch{return!1}t=me==null?void 0:me.localStorage}var r,o=FN||ah(e.hash,"__posthog")||ah(e.hash,"state"),c=o?Hb((()=>JSON.parse(atob(decodeURIComponent(o)))))||Hb((()=>JSON.parse(decodeURIComponent(o)))):null;return c&&c.action==="ph_authorize"?((r=c).source="url",r&&Object.keys(r).length>0&&(c.desiredHash?e.hash=c.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(x1)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}nl(e){var t=Ue.ph_load_toolbar||Ue.ph_load_editor;!at(t)&&Ai(t)?t(e,this.instance):C1.warn("No toolbar load function found")}loadToolbar(e){var t=!(Le==null||!Le.getElementById(eC));if(!me||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=je({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(me.localStorage.setItem(x1,JSON.stringify(je({},r,{source:void 0}))),this.il()===2)this.nl(r);else if(this.il()===0){var o;this.rl(1),(o=Ue.__PosthogExtensions__)==null||o.loadExternalDependency==null||o.loadExternalDependency(this.instance,"toolbar",(c=>{if(c)return C1.error("[Toolbar] Failed to load",c),void this.rl(0);this.rl(2),this.nl(r)})),hs(me,"turbolinks:load",(()=>{this.rl(0),this.loadToolbar(r)}))}return!0}sl(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},e4=je({experiments:Xs},xh),t4={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;at(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||Xx(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Ue==null?void 0:Ue.__PosthogExtensions__;if(e&&!Te(this.ol)&&this.ol)if(this.ll&&this.ll.token){this.al=!0;try{var t=e.initConversations;if(t)return this.ul(t),void(this.al=!1);var n=e.loadExternalDependency;if(!n)return void this.hl(tg);n(this._instance,"conversations",(r=>{r||!e.initConversations?this.hl("Could not load conversations script",r):this.ul(e.initConversations),this.al=!1}))}catch(r){this.hl("Error initializing conversations",r),this.al=!1}}else 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&&!ni(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var r=this;return os((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(qi.warn(Yr),null)}))()}getMessages(e,t){var n=this;return os((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(qi.warn(Yr),null)}))()}markAsRead(e){var t=this;return os((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(qi.warn(Yr),null)}))()}getTickets(e){var t=this;return os((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(qi.warn(Yr),null)}))()}requestRestoreLink(e){var t=this;return os((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(qi.warn(Yr),null)}))()}restoreFromToken(e){var t=this;return os((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(qi.warn(Yr),null)}))()}restoreFromUrlToken(){var e=this;return os((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()}}},s4={logs:class{constructor(e){var t;this.dl=!1,this.cl=!1,this.it=cs("[logs]"),this.Gr=[],this.vl=[],this.Js=0,this.fl=()=>{var n,r;this.Js=0,(n=this.pl)==null||n.onReconnect(),(r=this.gl)==null||r.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.dl=!0),me&&hs(me,"online",this.fl)}ml(e,t,n,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=Te(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,n);return[new o3(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 n;(n=this.pl)==null||n.reset(),this.wl=t;var r=this.ml((()=>this.Gr),(o=>{this.Gr=o}));this.pl=r[0],this.xl=r[1]}return this.pl}kl(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.gl||this.Sl!==t){var n;(n=this.gl)==null||n.reset(),this.Sl=t;var r=this.ml((()=>this.vl),(o=>{this.vl=o}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},A1);this.gl=r[0],this.Cl=r[1]}return this.gl}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var n=(t=e.config.logs)==null?void 0:t.captureConsoleLogs;!at(n)&&n&&(this.dl=!0,this.loadIfEnabled())}}reset(){var e,t;this.Gr=[],(e=this.pl)==null||e.reset(),this.vl=[],(t=this.gl)==null||t.reset(),this.Js=0}captureLog(e){this._l().captureLog(e)}le(e){this.kl().captureLog(e)}get logger(){return this.Ml||(this.Ml={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Ml}flushLogs(e){e?this.Il(e):(this.pl&&this.pl.flush().catch((t=>this.it.error("PostHog logs flush failed:",t))),this.gl&&this.gl.flush().catch((t=>this.it.error("PostHog logs flush failed:",t))))}loadIfEnabled(){if(this.dl&&!this.cl){var e=Ue==null?void 0:Ue.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(n=>{var r;n||(r=e.logs)==null||!r.initializeLogs?this.it.error("Could not load logs script",n):(e.logs.initializeLogs(this._instance),this.cl=!0)})):this.it.error(tg)}else this.it.error("PostHog Extensions not found.")}}yl(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:r=>r===Bn.LogsQueue?e():void 0,setPersistedProperty(r,o){var c;r===Bn.LogsQueue&&t((c=o)!==null&&c!==void 0?c:[])},$t:r=>this.$t(r),getLibraryId:()=>Pt.LIB_NAME,getLibraryVersion:()=>Pt.LIB_VERSION}}$t(e){return new Promise((t=>{if(hC(this.Js,3))t({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var n=!1,r=c=>{n||(n=!0,clearTimeout(o),t(c))},o=setTimeout((()=>r({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.Tl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:c=>{var 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=fC(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,Pt.LIB_NAME,(t=>{this.Gr=t})),this.vl.length>0&&this.Rl(e,this.vl,this.Cl,A1,(t=>{this.vl=t}))}Rl(e,t,n,r,o){if(t.length!==0){var c=t.map((l=>l.record));o([]);var f=Lx(c,$x(n,Pt.LIB_NAME,Pt.LIB_VERSION),r,Pt.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 n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.windowId,o=n.sessionStartTimestamp,c=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=r,at(o)||(t.sessionStartTimestamp=o),at(c)||(t.lastActivityTimestamp=c)}if(Ue!=null&&(e=Ue.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Sr(Ue.location.href):Ue.location.href),this._instance.featureFlags){var f=this._instance.featureFlags.getFlags();f&&f.length>0&&(t.activeFeatureFlags=f)}return t}}},i4={metrics:class{constructor(e){this.it=cs("[metrics]"),this._instance=e}initialize(){}_l(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.pl&&this.wl===n||((t=this.pl)==null||t.reset(),this.wl=n,this.pl=new l3(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}})(n),this.it)),this.pl}count(e,t,n){t===void 0&&(t=1),this._l().count(e,t,n)}gauge(e,t,n){this._l().gauge(e,t,n)}histogram(e,t,n){this._l().histogram(e,t,n)}flush(e){if(!this.pl)return Promise.resolve();if(e){var t=this.pl.drainWindow();return t&&this.Kt(t,e),Promise.resolve()}return this.pl.flush().catch((n=>this.it.error("PostHog metrics flush failed:",n)))}reset(){var e;(e=this.pl)==null||e.reset()}yl(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Kt:n=>t.Kt(n),getLibraryId:()=>Pt.LIB_NAME,getLibraryVersion:()=>Pt.LIB_VERSION}}Kt(e,t){return new Promise((n=>{var r=!1,o=f=>{r||(r=!0,clearTimeout(c),n(f))},c=setTimeout((()=>o({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(je({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)}}},n4=je({},xh,WN,GN,KN,YN,XN,ZN,JN,QN,e4,t4,s4,i4);Vi.__defaultExtensionClasses=je({},n4);var Ti=(function(){Pt.SDK_DIST_CHANNEL="npm";var e=ql[to]=new Vi;return(function(){function t(){t.done||(t.done=!0,HC=!1,Xt(ql,(function(n){n._dom_loaded()})))}Le!=null&&Le.addEventListener?Le.readyState==="complete"?t():hs(Le,"DOMContentLoaded",t,{capture:!1}):me&&Ne.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();function r4(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{Ti.capture(e,t)}catch{}}let Ka=null;function a4(){var e,t;if(Ka)return Ka;try{Ka=((t=(e=globalThis.crypto)==null?void 0:e.randomUUID)==null?void 0:t.call(e))??null}catch{Ka=null}return Ka??(Ka=`boot-${Math.random().toString(36).slice(2)}${Math.random().toString(36).slice(2)}`),Ka}function cg(e){try{const t={};for(const[n,r]of Object.entries(e))r!=null&&r!==""&&(t[n]=r);Ti.register(t)}catch{}}function o4(e){try{const t=r4(e);Ti.register({journey:t,view:l4(e)})}catch{}}function l4(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 c4=4e3;function u4(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.kind=="string"&&typeof t.label=="string"}function d4({sessionId:e,lastMessage:t,boundWorkflow:n,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:j,onOpenCode:C,workflows:T,onOpenWorkflow:A,onCanvasState:M,onGraphChange:L}){const[B,q]=U.useState(!1),F=U.useRef(M);F.current=M;const J=U.useRef(L);J.current=L;const te=U.useRef((n==null?void 0:n.path)??null);te.current=(n==null?void 0:n.path)??null;const[W,se]=U.useState(0),[ee,H]=U.useState(vh()),[$,O]=U.useState(!1),[P,z]=U.useState(!0),[I,G]=U.useState(!1),ie=U.useRef(null),X=U.useRef(null),V=U.useRef(0),ce=U.useCallback(()=>{z(!1),G(!0),ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>G(!1),360)},[]),ae=()=>{const _e=V.current-Date.now();X.current&&clearTimeout(X.current),_e>0?X.current=setTimeout(ce,_e):ce()};U.useEffect(()=>()=>{ie.current&&clearTimeout(ie.current),X.current&&clearTimeout(X.current)},[]),U.useEffect(()=>{if(!P)return;const _e=window.setTimeout(ce,c4);return()=>window.clearTimeout(_e)},[P,ce]);const[Y,Z]=U.useState(1),[ue,we]=U.useState({x:0,y:0}),[Ae,Ie]=U.useState(!1),$e=U.useRef(null),ct=U.useRef(null),[ut,mt]=U.useState(.25),et=_e=>Math.min(3,Math.max(ut,Math.round(_e*100)/100)),[vt,tt]=U.useState(null),Ke=U.useRef(!1),[Ot,jt]=U.useState({zoom:1,x:0,y:0}),fs=U.useCallback(()=>{const _e=$e.current;if(!vt||!_e)return null;const De=_e.getBoundingClientRect();if(De.width<80||De.height<80)return null;const Oe=De.width-vt.insetX*2,Ze=De.height-vt.insetTop-vt.insetBottom;if(Oe<=0||Ze<=0)return null;const ot=Math.min(1,Oe/vt.width,Ze/vt.height);return{zoom:Math.max(.1,Math.round(ot*100)/100),x:0,y:0}},[vt]),Dt=U.useCallback(()=>{let _e=12;const De=()=>{const Oe=fs();if(Oe){mt(Math.min(.25,Oe.zoom)),Ke.current=!1,Z(Oe.zoom),we({x:Oe.x,y:Oe.y}),jt(Oe);return}if(vt&&_e-- >0){requestAnimationFrame(De);return}mt(.25),Ke.current=!1,Z(1),we({x:0,y:0}),jt({zoom:1,x:0,y:0})};De()},[fs,vt]);U.useEffect(()=>{!vt||Ke.current||Dt()},[vt,Dt]),U.useEffect(()=>{const _e=$e.current;if(!_e||typeof ResizeObserver>"u")return;const De=new ResizeObserver(()=>{Ke.current||Dt()});return De.observe(_e),()=>De.disconnect()},[Dt]),U.useEffect(()=>{var Oe,Ze,ot;(Ze=(Oe=ct.current)==null?void 0:Oe.contentWindow)==null||Ze.postMessage({type:"sapiom-canvas:view",zoom:Y,x:ue.x,y:ue.y},"*");const _e=Fe.current,De=ct.current;if(_e&&De){const bs=De.getBoundingClientRect();(ot=De.contentWindow)==null||ot.postMessage({type:"sapiom-canvas:hover",x:_e.x-bs.left,y:_e.y-bs.top},"*")}},[Y,ue]),U.useEffect(()=>{const _e=$e.current;if(!_e)return;const De=Oe=>{Oe.preventDefault(),Ke.current=!0,Z(Ze=>et(Ze*(Oe.deltaY<0?1.1:1/1.1)))};return _e.addEventListener("wheel",De,{passive:!1}),()=>_e.removeEventListener("wheel",De)});const xt=_e=>{var Ze,ot;const De=ct.current;if(!De)return;const Oe=De.getBoundingClientRect();if(typeof _e.clientX=="number"&&typeof _e.clientY=="number"){const{clientX:bs,clientY:Ve,...He}=_e;(Ze=De.contentWindow)==null||Ze.postMessage({...He,x:bs-Oe.left,y:Ve-Oe.top},"*");return}(ot=De.contentWindow)==null||ot.postMessage(_e,"*")},[gs,It]=U.useState(!1),gt=U.useRef(!1),_s=U.useRef(0),Fe=U.useRef(null),Ts=_e=>{if(Fe.current={x:_e.clientX,y:_e.clientY},Ae)return;const{clientX:De,clientY:Oe}=_e;cancelAnimationFrame(_s.current),_s.current=requestAnimationFrame(()=>{xt({type:"sapiom-canvas:hover",clientX:De,clientY:Oe})})},ts=()=>{cancelAnimationFrame(_s.current),Fe.current=null,It(!1),gt.current=!1,xt({type:"sapiom-canvas:hover",x:-1,y:-1})},vi=_e=>{if(_e.button!==0)return;const De=_e.currentTarget;try{De.setPointerCapture(_e.pointerId)}catch{}Ie(!0),xt({type:"sapiom-canvas:press",clientX:_e.clientX,clientY:_e.clientY,down:!0});let Oe=!0;const Ze=()=>{Oe&&(Oe=!1,xt({type:"sapiom-canvas:press",down:!1}))};let ot=_e.clientX,bs=_e.clientY;const Ve=_e.clientX,He=_e.clientY,lt=Jt=>{const sn=Jt.clientX-ot,So=Jt.clientY-bs;ot=Jt.clientX,bs=Jt.clientY,(Math.abs(Jt.clientX-Ve)>=4||Math.abs(Jt.clientY-He)>=4)&&(Ze(),Ke.current=!0),we(nn=>({x:nn.x+sn,y:nn.y+So}))},ss=Jt=>{Ie(!1),Ze(),De.removeEventListener("pointermove",lt),De.removeEventListener("pointerup",ss),De.removeEventListener("pointercancel",ss),Math.abs(Jt.clientX-Ve)<4&&Math.abs(Jt.clientY-He)<4&&(xt({type:"sapiom-canvas:pick",clientX:Jt.clientX,clientY:Jt.clientY}),gt.current||Gs(null))};De.addEventListener("pointermove",lt),De.addEventListener("pointerup",ss),De.addEventListener("pointercancel",ss)},[ps,Gs]=U.useState(null);U.useEffect(()=>{if(w==="steps"&&x&&f||!f&&ps==null)return;const _e=De=>{De.key==="Escape"&&(ps!=null?Gs(null):l())};return window.addEventListener("keydown",_e),()=>window.removeEventListener("keydown",_e)},[f,ps,l,x,w]);const[ri,Zs]=U.useState(!0),[ys,Ds]=U.useState(!1),[ai,Is]=U.useState(null),[$s,st]=U.useState(null),[Ge,ke]=U.useState(null),[Xe,Vt]=U.useState(null);U.useEffect(()=>{const _e=De=>{var Ze,ot,bs;const Oe=De.data;if(!(!Oe||De.source!==((Ze=ct.current)==null?void 0:Ze.contentWindow))){if(Oe.type==="sapiom-canvas:overview")Is({description:typeof Oe.description=="string"?Oe.description:"",stats:typeof Oe.stats=="string"?Oe.stats:"",notes:Array.isArray(Oe.notes)?Oe.notes.filter(Ve=>typeof Ve=="string"):[],badges:Array.isArray(Oe.badges)?Oe.badges.filter(Ve=>typeof Ve=="string"):[],legend:Array.isArray(Oe.legend)?Oe.legend.filter(u4):[]});else if(Oe.type==="sapiom-canvas:graph"){const Ve=lj(Oe.graph);ke(Ve);const He=te.current;Ve&&He&&((ot=J.current)==null||ot.call(J,He,Ve)),(bs=F.current)==null||bs.call(F,!0)}else if(Oe.type==="sapiom-canvas:node"){const Ve=Oe.id;typeof Ve=="string"&&Gs(Ve)}else if(Oe.type==="sapiom:node-click"){const Ve=Oe.stepName;typeof Ve=="string"&&ke(He=>{if(He){const lt=He.nodes.find(ss=>ss.label===Ve)??He.nodes.find(ss=>ss.id===Ve)??null;lt&&Gs(lt.id)}return He})}else if(Oe.type==="sapiom-canvas:hit"){const Ve=typeof Oe.id=="string";It(Ve),gt.current=Ve}else if(Oe.type==="sapiom-canvas:size"){const Ve=Oe;typeof Ve.width=="number"&&Ve.width>0&&typeof Ve.height=="number"&&Ve.height>0&&tt({width:Ve.width,height:Ve.height,insetTop:typeof Ve.insetTop=="number"&&Ve.insetTop>=0?Ve.insetTop:0,insetBottom:typeof Ve.insetBottom=="number"&&Ve.insetBottom>=0?Ve.insetBottom:0,insetX:typeof Ve.insetX=="number"&&Ve.insetX>=0?Ve.insetX:0})}else if(Oe.type==="sapiom-canvas:error"){const Ve=Oe;st({title:typeof Ve.title=="string"?Ve.title:"",reason:typeof Ve.reason=="string"?Ve.reason:""})}}};return window.addEventListener("message",_e),()=>window.removeEventListener("message",_e)},[]),U.useEffect(()=>{Is(null),st(null),ke(null),Gs(null),Vt(null),Zs(!0),It(!1),gt.current=!1,tt(null),Z(1),we({x:0,y:0}),jt({zoom:1,x:0,y:0}),Ke.current=!1},[e,W]);const Ns=Ge&&ps?Ge.nodes.find(_e=>_e.id===ps)??null:null;U.useEffect(()=>{var _e,De;(De=(_e=ct.current)==null?void 0:_e.contentWindow)==null||De.postMessage({type:"sapiom-canvas:select",id:ps},"*")},[ps]);const gi=U.useCallback(()=>{var _e,De;!x||!g||!e||zv()||P||(De=(_e=ct.current)==null?void 0:_e.contentWindow)==null||De.postMessage({type:"sapiom:run-state",steps:x.steps,status:x.status,target:g},"*")},[x,g,e,P]);U.useEffect(()=>{gi()},[gi]);const Ks=ai??void 0,[_i,Mi]=U.useState(new Set);U.useEffect(()=>Hv(H),[]),U.useEffect(()=>{var De;if(z(!0),!e){q(!1),(De=F.current)==null||De.call(F,!1);return}q(!1);let _e=!1;return O(!0),fetch(`/canvas/${e}/`,{method:"HEAD"}).then(Oe=>{var Ze;_e||(q(Oe.ok),Oe.ok||(Ze=F.current)==null||Ze.call(F,!1))}).catch(()=>{}).finally(()=>!_e&&O(!1)),()=>{_e=!0}},[e]),U.useEffect(()=>{!t||!e||t.type==="canvas.reload"&&t.harnessSessionId===e&&(q(!0),z(!0),se(_e=>_e+1))},[t,e]);const oe=(n==null?void 0:n.path)??null;U.useEffect(()=>{z(!0),se(_e=>_e+1),Z(1),we({x:0,y:0}),jt({zoom:1,x:0,y:0}),Ke.current=!1},[oe]);const ge=m.filter(_e=>_e.harnessSessionId===e&&(_e.workflowPath==null||_e.workflowPath===oe)),ve=ge.some(_e=>_e.status==="running"&&_e.macroId==="describe"),Se=ge.find(_e=>_e.status==="running"&&_e.macroId!=="describe")??null,Me=ge.filter(_e=>_e.status!=="running"&&_e.macroId!=="describe").sort((_e,De)=>(De.endedAt??"").localeCompare(_e.endedAt??""))[0],Je=!Se&&(Me==null?void 0:Me.status)==="failed"&&!_i.has(Me.id)?Me:null,_t=Je?d.find(_e=>_e.id===Je.macroId)??null:null,Rt=d.find(_e=>_e.id==="visualize")??null,Tt=e!=null&&!0,yt=B&&Tt,At=h.jsx(h.Fragment,{children:k&&h.jsx(hT,{deployState:k,workflow:n,onDismiss:j,onOpenCode:C})});return h.jsxs("aside",{className:"canvas-pane",...Ft({surface:"canvas"}),children:[n&&!o&&h.jsx(ET,{workflow:n,detailStep:null,onBack:()=>{},onAskAgent:v,surface:w,stepsSummary:Ge&&Ge.nodes.length>0?aj(Ge):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."}):Je?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})," ",Je.label," failed."]}),Je.errorTail&&h.jsx("pre",{className:"canvas-task-error",children:Je.errorTail}),h.jsxs("div",{className:"canvas-task-actions",children:[_t&&h.jsx("button",{className:"btn-primary","data-testid":"canvas-task-retry",onClick:()=>y(_t),children:"Retry"}),h.jsx("button",{className:"btn-ghost","data-testid":"canvas-task-dismiss",onClick:()=>Mi(_e=>{const De=new Set(_e);return De.add(Je.id),De}),children:"Dismiss"})]})]}):Se&&!yt?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:[Se.label," is running…"]})}),Se.statusLines.length>0&&h.jsx("ul",{className:"canvas-task-lines","data-testid":"canvas-task-lines",children:Se.statusLines.slice(-8).map((_e,De)=>h.jsx("li",{children:_e},`${De}-${_e}`))}),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."})]}):$?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…"})]}):!yt&&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:[At,x&&h.jsx(Sb,{run:x,target:g,workflow:n,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"})})]})}):!yt&&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.`}):yt?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:Y<=ut+.001,onClick:()=>{Ke.current=!0,Z(_e=>Math.max(ut,Math.round((_e-.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:Y===1,onClick:()=>{Ke.current=!0,Z(1)},children:[Math.round(Y*100),"%"]}),h.jsx("button",{className:"theme-toggle","data-testid":"canvas-zoom-in","aria-label":"Zoom in",title:"Zoom in",disabled:Y>=2,onClick:()=>{Ke.current=!0,Z(_e=>Math.min(2,Math.round((_e+.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:Y===Ot.zoom&&ue.x===Ot.x&&ue.y===Ot.y,onClick:Dt,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})}),(P||I)&&h.jsxs("div",{className:"canvas-skeleton canvas-loading--overlay"+(P?"":" 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"})]}),$s&&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 _e=$s.reason.trim();return _e.length<4?"The agent graph could not be extracted. Open the terminal for details.":_e.includes(": ")?_e.slice(_e.indexOf(": ")+2).split(". ")[0]:_e})()}),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 ${$s.title||"this agent"} failed: ${$s.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:()=>{Rt?y(Rt):(V.current=Date.now()+900,z(!0),se(_e=>_e+1))},children:"Retry"})]}),h.jsxs("details",{className:"canvas-error-details",children:[h.jsx("summary",{children:"Details"}),h.jsx("pre",{children:$s.reason.trim().length>=4?$s.reason:"The rendered document reported a failure without details. Re-render the diagram or check the terminal."})]})]}),Se&&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:[Se.label," is running…"]})}),Se.statusLines.length>0&&h.jsx("ul",{className:"canvas-task-lines","data-testid":"canvas-task-lines",children:Se.statusLines.slice(-8).map((_e,De)=>h.jsx("li",{children:_e},`${De}-${_e}`))}),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."})]}),Ks&&!ri&&!Ns&&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:()=>Zs(!0),children:"i"}),w==="board"&&h.jsx("button",{className:"theme-toggle canvas-chat-toggle"+(ys?" is-active":""),"data-testid":"canvas-chat-toggle","aria-label":ys?"Close chat":"Open chat","data-tooltip":"Chat — ask about this agent or the selected step",onClick:()=>Ds(_e=>!_e),children:h.jsx(de,{name:"MessageSquare",size:14})}),h.jsx("iframe",{ref:ct,className:"canvas-iframe",src:`/canvas/${e}/?theme=${ee}`,sandbox:"allow-scripts",scrolling:"no",onLoad:()=>{var _e,De,Oe,Ze;ae(),(De=(_e=ct.current)==null?void 0:_e.contentWindow)==null||De.postMessage({type:"sapiom-canvas:view",zoom:Y,x:ue.x,y:ue.y},"*"),x&&g&&e&&((Ze=(Oe=ct.current)==null?void 0:Oe.contentWindow)==null||Ze.postMessage({type:"sapiom:run-state",steps:x.steps,status:x.status,target:g},"*"))},onError:ce},`${e}:${W}`),h.jsx("div",{ref:$e,className:"canvas-pan-layer"+(Ae?" is-panning":""),"data-testid":"canvas-pan-layer","data-over-node":gs&&!Ae?"true":void 0,onPointerDown:vi,onPointerMove:Ts,onPointerLeave:ts,onDoubleClick:Dt})]}),w==="steps"&&h.jsxs("div",{className:"canvas-steps-surface","data-testid":"canvas-steps-surface",children:[At,x?h.jsx(Sb,{run:x,target:g,workflow:n,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"})}):Ge&&Ge.nodes.length>0?h.jsx(gT,{graph:Ge,run:x,runTarget:g,workflows:T,onOpenWorkflow:A,onAskAgent:v,expandedId:Xe,onToggle:_e=>Vt(De=>De===_e?null:_e)}):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"&&(Ks&&ri||Ns)&&h.jsx(ST,{overview:Ks??null,selectedNode:Ns,graph:Ge,run:x,workflows:T,onOpenWorkflow:A,onOpenSteps:()=>{ps&&Vt(ps),R()},onDeselect:()=>Gs(null),onCollapse:()=>Zs(!1),onDescribeWithAI:n&&e&&!c?()=>S(n):void 0,describing:ve}),w==="board"&&ys&&h.jsx(bT,{node:Ns,run:x,onInjectPrompt:v,onClose:()=>Ds(!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 h4="https://tools.sapiom.ai",f4="x-sapiom-api-key",p4="YOUR_SAPIOM_API_KEY";function m4(e){return e==null?"{ /* your input */ }":JSON.stringify(e,null,2).replace(/\n/g,`
|
|
455
|
-
`)}function v4(e){return e==null?"{}":JSON.stringify(e)}function g4(e){return e.replace(/'/g,"'\\''")}function _4(e,t){return`import { agents } from "@sapiom/tools";
|
|
456
|
-
|
|
457
|
-
const result = await agents.run({
|
|
458
|
-
definition: ${JSON.stringify(e)},
|
|
459
|
-
input: ${m4(t)},
|
|
460
|
-
});
|
|
461
|
-
|
|
462
|
-
if (result.status === "completed") {
|
|
463
|
-
console.log(result.output);
|
|
464
|
-
}
|
|
465
|
-
`}function y4(e,t,n){const r=g4(`{ "input": ${v4(t)} }`),o=encodeURIComponent(e);return`curl -X POST ${n}/agents/v1/definitions/${o}/executions \\
|
|
466
|
-
-H "${f4}: ${p4}" \\
|
|
467
|
-
-H "Content-Type: application/json" \\
|
|
468
|
-
-d '${r}'
|
|
469
|
-
`}function b4(e){const{definition:t,inputSample:n,baseUrl:r=h4}=e;return{typescript:_4(t,n),curl:y4(t,n,r)}}const S4=new Set(["pending","queued","building"]),w4=new Set(["failed","cancelled","superseded","stale"]);function yo(e,t=null){return e.activeBuildRunStatus==="ready"?"ready":e.activeBuildRunStatus!=null&&S4.has(e.activeBuildRunStatus)?"building":t!=null||e.activeBuildRunStatus!=null&&w4.has(e.activeBuildRunStatus)?"failed":e.definitionId==null?"draft":"linked"}function Id(e){return(e==null?void 0:e.activeBuildRunStatus)==="ready"}function R1(e,t=null){switch(yo(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 x4="https://app.sapiom.ai/settings?tab=api-keys";function C4({boundWorkflow:e,agentsBaseUrl:t}){return Id(e)?h.jsx(E4,{boundWorkflow:e,agentsBaseUrl:t}):null}function E4({boundWorkflow:e,agentsBaseUrl:t}){const[n,r]=U.useState("typescript"),[o,c]=U.useState(!1),f=e.definitionSlug==null,l=e.definitionSlug??e.name,{typescript:d,curl:m}=b4({definition:l,baseUrl:t}),y=n==="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",...Ft({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":n==="typescript","aria-controls":"snippet-code-panel",className:"snippet-tab"+(n==="typescript"?" is-active":""),"data-testid":"snippet-tab-ts",onClick:()=>r("typescript"),children:"TypeScript (SDK)"}),h.jsx("button",{role:"tab","aria-selected":n==="curl","aria-controls":"snippet-code-panel",className:"snippet-tab"+(n==="curl"?" is-active":""),"data-testid":"snippet-tab-curl",onClick:()=>r("curl"),children:"cURL (HTTP)"})]}),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:[n==="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:x4,target:"_blank",rel:"noreferrer",children:"Sapiom dashboard"}),"."]})]})}function k4({boundWorkflow:e,noSessionAgent:t=null,agentsBaseUrl:n,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=yo(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",...Ft({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(C4,{boundWorkflow:e,agentsBaseUrl:n},e.path)}):h.jsx(Zi,{className:"code-panel-empty",icon:"Code",title:l,body:d})]})}const j4="https://docs.sapiom.ai/",A4=[{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"}],kv=1,jv=12,zC=10,UC=20,R4=25,T4=e=>-(3+Math.min(e,9)),N4=new Set(["/","\\","-","_",".",":"," "]),T1=e=>e>="0"&&e<="9",M4=e=>e!==e.toUpperCase()&&e===e.toLowerCase(),O4=e=>e!==e.toLowerCase()&&e===e.toUpperCase();function D4(e){const t=new Array(e.length);for(let n=0;n<e.length;n++){if(n===0){t[n]=!0;continue}const r=e[n-1],o=e[n];t[n]=N4.has(r)||T1(o)!==T1(r)||O4(o)&&M4(r)}return t}function $4(e,t,n,r){var S;const o=e.length,c=t.length,f=(w,R)=>{let x=kv;n[R]&&(x+=jv),R===w+1&&(x+=zC);const g=R-w-1;return g>=1&&(x+=T4(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 j=f(R,k)+d(w+1,k);j>p&&(p=j,_=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=kv+jv+(w===0?UC: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 L4(e,t,n){let r=null;for(let c=0;;){const f=t.indexOf(e,c);if(f===-1)break;let l=f===0?UC:0;for(let d=0;d<e.length;d++)l+=kv,n[f+d]&&(l+=jv),d>0&&(l+=zC);(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 gm(e){let t="";for(let n=0;n<e.length;n++){const r=e[n].toLowerCase();t+=r.length===1?r:e[n]}return t}function N1(e,t){const n=[...new Set(gm(e).split(/\s+/).filter(Boolean))];if(n.length===0)return{score:0,indices:[]};if(!t)return null;const r=gm(t),o=D4(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 n){if(d.length>r.length)return null;const m=$4(d,r,o,c),y=L4(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 gm(e.trim())===r&&(f+=R4),{score:f,indices:[...l].sort((d,m)=>d-m)}}function qC(e){return e.includes("\\")?"\\":"/"}function I4(e,t){return`${e.trim().replace(/[\\/]+$/,"")}${qC(e)}${t.trim()}`}function br(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function FC(e){const t=e.replace(/[\\/]+$/,"");if(t===""||/^[A-Za-z]:$/.test(t))return null;const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));if(n<0)return null;const r=t.slice(0,n);return/^[A-Za-z]:$/.test(r)?r+t[n]:r||"/"}function Zl(e){const t=e.replace(/[\\/]+$/,"");return t===e?e:t===""?e[0]:/^[A-Za-z]:$/.test(t)?t+e[t.length]:t}function M1(e,t){return Zl(e.replace(/\\/g,"/"))===Zl(t.replace(/\\/g,"/"))}function ug(e,t){const n=Zl(e.replace(/\\/g,"/")),r=Zl(t.replace(/\\/g,"/"));return r===n?!0:n.endsWith("/")?r.startsWith(n):r.startsWith(`${n}/`)}function P4(e){return e.startsWith("/")||e.startsWith("~")||/^[A-Za-z]:[\\/]/.test(e)}function B4(e){const t=qC(e),n=e.split(/[\\/]/).filter(Boolean);return n.length<=2?e:`${t==="\\"?"":t}${n[0]}${t}…${t}${n[n.length-1]}`}function O1(e,t){var n;return(n=t[e.id])!=null&&n.trim()?!1:!e.title||e.title===br(e.cwd)}function dh(e,t,n){var l;const r=(l=n[e.id])==null?void 0:l.trim();if(r)return r;if(!O1(e,n))return e.title;const o=br(e.cwd),f=t.filter(d=>d.cwd===e.cwd&&(d.status!=="exited"||d.id===e.id)&&O1(d,n)).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 _m=br,Pd=(e,t)=>ug(t,e),Av=e=>(t,n)=>e==="name"?t.name.localeCompare(n.name):t.path.localeCompare(n.path);function H4(e,t,n="workspace",r="recent",o=[],c=[]){return n==="deployment"?z4(e,r):U4(e,t,r,o,c)}function z4(e,t){const n=Av(t),r=(c,f,l)=>({cwd:`deployment:${f}`,label:c,isDirectory:!1,agents:e.filter(l).sort(n).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 U4(e,t,n,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:n==="name"?_m(g).localeCompare(_m(b))||g.localeCompare(b):v(g,b)||g.localeCompare(b)}),w=g=>{let b=null;for(const p of S)Pd(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(Av(n)).map(k=>(f.delete(k),{workflow:k})),p=c.filter(k=>k.boundWorkflowPath==null&&w(k.cwd)===g).sort((k,j)=>j.createdAt.localeCompare(k.createdAt)||k.id.localeCompare(j.id)),_=l.has(g)&&b.length===0&&p.length===0;b.length===0&&p.length===0&&!_||R.push({cwd:g,label:_m(g),isDirectory:!0,agents:b,bareSessions:p,pending:_})}const x=Array.from(f).sort(Av(n)).map(g=>({workflow:g}));return{workspaces:R,orphanAgents:x}}const kl=[{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"}],q4={templates:{label:"Browse templates",actionId:"browse-templates"},docs:{label:"Open documentation",href:j4}},F4=6,V4=6,Au=20,W4=6,VC=36e5,ym=24*VC;function D1(e,t){if(t<=0)return 0;const n=e-t;return n<=VC?30:n<=ym?20:n<=7*ym?12:n<=30*ym?6:0}const Ru=e=>{const t=Date.parse(e);return Number.isNaN(t)?0:t},G4=(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 K4(e){const{sessions:t,workflows:n,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:dh(C,t,c),meta:C.cwd,sessionId:C.id,current:C.id===d||void 0,recency:Ru(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:dh(C,t,c),meta:C.cwd,sessionId:C.id,recency:Ru(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 T;return{item:{id:`summary:${C.agentSessionId}`,kind:"past",label:((T=c[C.harnessSessionId??""])==null?void 0:T.trim())||C.title,meta:C.cwd,summary:C,recency:Ru(C.lastActiveAt)},cwd:C.cwd,count:C.turnCount??C.messageCount??0,fromRegistry:!1}})],w=new Map;for(const C of S){const T=`${C.item.label.trim()}\0${C.cwd}`,A=w.get(T);(!A||G4(C,A))&&w.set(T,C)}const R=[...w.values()].map(C=>C.item).sort((C,T)=>T.recency-C.recency),x=C=>{let T=0;for(const M of t){if(M.boundWorkflowPath!==C.path&&!Pd(M.cwd,C.path))continue;const L=Ru(M.lastActiveAt);L>T&&(T=L)}if(T>0)return T;const A=o.findIndex(M=>Pd(C.path,M)||Pd(M,C.path));return A===-1?0:o.length-A},g=n.map(C=>({id:`agent:${C.path}`,kind:"agent",label:Vv(C.name),meta:C.path,path:C.path,recency:x(C)})),b=new Set(n.map(C=>C.path)),p=o.filter(C=>!b.has(C)).map(C=>({id:`recent:${C}`,kind:"recent",label:br(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=A4.map(C=>({id:`doc:${C.href}`,kind:"doc",label:C.label,meta:C.meta,href:C.href,recency:0})),j=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,...j,...k,..._]}const $1={session:0,agent:1,past:2,recent:3,template:4,doc:5,command:6,path:7},Y4={all:["session","agent","past","recent","template","doc","command"],sessions:["session","past"],agents:["agent"],templates:["template"],docs:["doc"],files:["recent"],actions:["command"]},Rv=(e,t)=>e.filter(n=>n.kind===t);function Xr(e,t){const n=Rv(e,t);return t==="session"?n.sort((r,o)=>(r.current?1:0)-(o.current?1:0)||o.recency-r.recency):t==="past"?n.sort((r,o)=>o.recency-r.recency):t==="agent"?n.sort((r,o)=>o.recency-r.recency||r.label.localeCompare(o.label)):t==="recent"?n.sort((r,o)=>o.recency-r.recency):n}function X4(e,t,n={}){const r=n.filter??"all",o=n.now??Date.now(),c=Y4[r],f=e.trim();if(!f){if(r!=="all")return c.flatMap(v=>Xr(t,v)).slice(0,Au);const y=Rv(t,"command");return[...Xr(t,"session"),...Xr(t,"past").slice(0,F4),...Xr(t,"agent").slice(0,W4),...Xr(t,"recent"),...Xr(t,"template"),...Xr(t,"doc")].slice(0,Math.max(0,Au-y.length)).concat(y)}const l=y=>{const v=N1(f,y.label);if(v)return{item:{...y,labelIndices:v.indices},fieldRank:0,boosted:v.score+D1(o,y.recency),matchedLength:y.label.length};const S=y.meta?N1(f,y.meta):null;return S?{item:{...y,metaIndices:S.indices},fieldRank:1,boosted:S.score+D1(o,y.recency),matchedLength:y.meta.length}:null},d=c.map(y=>({kind:y,scored:Rv(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?V4:Au;return d.sort((y,v)=>{const S=y.scored[0],w=v.scored[0];return S.fieldRank-w.fieldRank||w.boosted-S.boosted||$1[y.kind]-$1[v.kind]}).flatMap(y=>y.scored.slice(0,m).map(v=>v.item)).slice(0,Au)}function J4(e,t){const n=e.trim();return[...n?[{id:`confirm:${n}`,kind:"path",label:n,meta:"Open this path",path:n,recency:0}]:[],...t.map(o=>({id:`dir:${o.path}`,kind:"path",label:o.name,meta:o.path,path:o.path,recency:0}))]}function Z4(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 Q4=/^[a-z0-9][a-z0-9-]{0,213}$/,dg="sapiom-agent",e5=3,L1=32,t5=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 WC(e){return Q4.test(e)}function s5(e){var f;const t=e.toLowerCase().replace(/[^a-z0-9]+/g," ").split(" ").filter(Boolean),n=t.filter(l=>!t5.has(l)),r=n.length>0?n:t,o=[];for(const l of r.slice(0,e5)){if((o.length===0?l:`${o.join("-")}-${l}`).length>L1)break;o.push(l)}const c=o.join("-")||((f=r[0])==null?void 0:f.slice(0,L1))||"";return WC(c)?c:dg}function GC(e,t){const n=(t==null?void 0:t.trim())??"",r=e.trim();return!n.replace(/[\\/]+$/,"")||!r?"":I4(n,r)}function i5(e){var t,n,r;return((t=e.settingsRoot)==null?void 0:t.trim())||((n=e.defaultProjectRoot)==null?void 0:n.trim())||((r=e.launchDir)==null?void 0:r.trim())||""}const n5=FC;function r5(e,t){const n=new Set(t);if(!n.has(e))return e;for(let r=2;r<1e3;r+=1){const o=`${e}-${r}`;if(!n.has(o)&&WC(o))return o}return e}const hh=[{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."}],a5={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 o5(e){return e?a5[e]??e.replace(/-/g," ").replace(/^./,t=>t.toUpperCase()):"Uncategorised"}function hg(e){return e!=null&&e.label?e.score>0?`${e.label} ${e.score}/5`:e.label:"—"}function KC(e){const{basis:t}=e,n=[];t.llmSteps>0&&n.push(`${t.llmSteps} model ${t.llmSteps===1?"step":"steps"}`),t.chainedLlmSteps>0&&n.push(`${t.chainedLlmSteps} chained`),t.mediaCapabilities>0&&n.push(`${t.mediaCapabilities} media ${t.mediaCapabilities===1?"generator":"generators"}`),n.push(`${t.stepCount} ${t.stepCount===1?"step":"steps"}`),t.capabilityCount>0&&n.push(`${t.capabilityCount} ${t.capabilityCount===1?"capability":"capabilities"}`);const r=t.llmSteps===0&&t.mediaCapabilities===0?" · deterministic":"";return`${n.join(", ")}${r}`}function l5(e){return`${e.label}: ${KC(e)}`}function I1(e,t){const n=t.trim().toLowerCase();return n?[e.name,e.description,e.id,...e.kind==="gallery"?e.tags:[],...e.kind==="gallery"?e.capabilities:[]].join(" ").toLowerCase().includes(n):!0}function c5(e,t){const n="When the project is ready, offer a local test run with no Sapiom capability spend (sapiom_dev_agents_run_local) as the next step.";return e.kind==="gallery"?`Clone the Sapiom gallery template "${e.id}" into this directory: call the sapiom_dev_agents_clone tool with dir "${t}" and templateId "${e.id}". If it reports you are not authenticated, run sapiom_authenticate first and retry. After the clone, read the project's AGENTS.md and run npm install. `+n:`Scaffold the "${e.id}" starter in this directory: ${Tv(t,e.id)}, then run npm install and read AGENTS.md. Keep the shipped starter unchanged until the user describes what to build. `+n}function u5(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 Tv(e,t){return"call the sapiom_dev_agents_scaffold tool with "+JSON.stringify({dir:e,template:t})}function d5(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})),n=new Map;for(const f of e.transitions)f.kind==="continue"&&n.set(f.from,(n.get(f.from)??0)+1);const r=e.transitions.map(f=>({from:f.from,to:f.to,kind:f.kind==="pause"?"cross":(n.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 h5(e,t){const n=e.kind==="starter"&&e.id==="default"?dg:e.id;return GC(n,t)}function f5(e){const t=U.useRef(null),[n,r]=U.useState(null),o=U.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=U.useRef(null),f=U.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 U.useLayoutEffect(()=>{o()},[e,o]),U.useLayoutEffect(()=>()=>{var l;return(l=c.current)==null?void 0:l.disconnect()},[]),{trackRef:f,style:n?{transform:`translateX(${n.x}px)`,width:`${n.w}px`,opacity:1}:{opacity:0}}}const p5={command:"Zap",doc:"BookOpen",session:"Radio",past:"History",agent:"Workflow",recent:"Folder",path:"Folder",template:"LayoutTemplate"},bm={command:"Actions",doc:"Documentation",session:"Sessions",past:"Past sessions",agent:"Agents",recent:"Folders",path:"Folders",template:"Templates"},m5=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),v5=m5?"⌘":"Ctrl";function P1(e,t){if(!t||t.length===0)return e;const n=new Set(t),r=[];let o="",c=n.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=n.has(l);d!==c&&(f(l),c=d),o+=e[l]}return f(e.length),r}function g5({sessions:e,workflows:t,recentDirs:n,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]=U.useState(""),[g,b]=U.useState("all"),[p,_]=U.useState([]),[k,j]=U.useState([]),[C,T]=U.useState(!1),[A,M]=U.useState(!1),[L,B]=U.useState(0),q=f5(g),F=U.useRef(null);U.useEffect(()=>{var $;($=F.current)==null||$.focus()},[]),U.useEffect(()=>{let $=!1;return _(hh.map(({id:O,name:P,description:z})=>({id:O,name:P,description:z}))),d().then(O=>{$||_([...O.templates.map(({id:P,name:z,description:I})=>({id:P,name:z,description:I})),...hh.map(({id:P,name:z,description:I})=>({id:P,name:z,description:I}))])}).catch(()=>{}),()=>{$=!0}},[d]);const J=P4(R);U.useEffect(()=>{if(!J){j([]),M(!1);return}let $=!1;T(!0),M(!1);const O=setTimeout(()=>{l(R).then(P=>{$||j(P.dirs)}).catch(()=>{$||(j([]),M(!0))}).finally(()=>!$&&T(!1))},150);return()=>{$=!0,clearTimeout(O)}},[R,J,l]);const te=U.useMemo(()=>J?J4(R,k):X4(R,K4({sessions:e,workflows:t,history:r,recentDirs:n,sessionNames:o,actions:f,templates:p,activeSessionId:c}),{filter:g}),[R,J,k,e,t,n,r,o,c,f,p,g]);U.useEffect(()=>{const $=te.findIndex(O=>!O.current);B($===-1?0:$)},[te,R,g]);const W=J?void 0:q4[g],se=$=>{const O=Z4($);switch(O.type){case"run":O.run();break;case"open-href":window.open(O.href,"_blank","noopener,noreferrer");break;case"open-template":S(O.templateId);break;case"select-session":m(O.sessionId);break;case"review-summary":y(O.summary);break;case"open-path":v(O.path);break}w()},ee=$=>{b(O=>{const z=(kl.findIndex(I=>I.id===O)+$+kl.length)%kl.length;return kl[z].id})},H=$=>{if($.key==="ArrowDown")$.preventDefault(),B(O=>Math.min(O+1,te.length-1));else if($.key==="ArrowUp")$.preventDefault(),B(O=>Math.max(O-1,0));else if($.key==="Tab"&&!J)$.preventDefault(),ee($.shiftKey?-1:1);else if($.key==="Enter"){$.preventDefault();const O=te[L];O&&se(O)}else $.key==="Escape"&&(R?x(""):w())};return h.jsx("div",{className:"modal-backdrop",onClick:w,children:h.jsxs("div",{className:"modal command-palette",onClick:$=>$.stopPropagation(),...Ft({dialog:"command_palette"}),children:[h.jsxs("div",{className:"command-palette-search",children:[h.jsx(de,{name:"Search",size:16}),h.jsx("input",{ref:F,className:"command-palette-input","data-testid":"command-palette-input","aria-label":"Jump to a session, agent, or path",placeholder:"Jump to a session, agent, or path…",value:R,onChange:$=>x($.target.value),onKeyDown:H}),R&&h.jsx("button",{type:"button",className:"command-palette-clear","data-testid":"command-palette-clear","aria-label":"Clear search",onClick:()=>{var $;x(""),($=F.current)==null||$.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"}),kl.map($=>h.jsxs("button",{type:"button",role:"tab","aria-selected":g===$.id,className:"command-palette-filter"+(g===$.id?" is-active":""),"data-testid":`command-palette-filter-${$.id}`,onClick:()=>{var O;b($.id),(O=F.current)==null||O.focus()},children:[h.jsx(de,{name:$.icon,size:14}),$.label]},$.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&&A&&!C&&h.jsx("div",{className:"command-palette-error","data-testid":"command-palette-error",role:"alert",children:"Couldn't read that path."}),te.length===0&&!C&&!A&&h.jsx("div",{className:"command-palette-empty",children:"No matches"}),te.map(($,O)=>h.jsxs("div",{className:"command-palette-row",children:[!J&&(O===0||bm[$.kind]!==bm[te[O-1].kind])&&h.jsx("div",{className:"command-palette-section","data-testid":"command-palette-section",children:bm[$.kind]}),h.jsxs("button",{type:"button",className:"command-palette-item"+(O===L?" is-selected":"")+($.current?" is-current":""),"data-testid":`command-palette-item-${O}`,onMouseEnter:()=>B(O),onClick:()=>se($),children:[h.jsx(de,{name:$.icon??p5[$.kind],size:14}),h.jsx("span",{className:"command-palette-item-label",children:P1($.label,$.labelIndices)}),$.current&&h.jsx("span",{className:"command-palette-current",children:"current"}),h.jsx("span",{className:"command-palette-item-meta","data-code":$.path!=null||$.kind==="session"||$.kind==="past"||void 0,children:$.meta?P1($.meta,$.metaIndices):null})]})]},$.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 $=f.find(O=>O.id===W.actionId);$&&($.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:v5}),h.jsx("kbd",{children:"K"})," anytime"]})]})]})})}const _5={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 y5({status:e,onRetry:t,retrying:n=!1,detail:r,onStartAuth:o}){const c=_5[e],[f,l]=U.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:n||f.status==="pending",children:n?"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 b5({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 S5(e,t,n){const r=new Map;for(const o of t)r.has(o.agentSessionId)||r.set(o.agentSessionId,o);for(const o of e)n.has(o.cwd)||r.has(o.agentSessionId)||r.set(o.agentSessionId,o);return Array.from(r.values()).sort((o,c)=>c.lastActiveAt.localeCompare(o.lastActiveAt))}const w5=12;function YC(e,t,n){var c;const r=[],o=f=>{f&&!r.includes(f)&&r.push(f)};return o((c=e.find(f=>f.id===n))==null?void 0:c.cwd),e.forEach(f=>o(f.cwd)),t.forEach(f=>o(f)),r.slice(0,w5)}const tc={"claude-code":"Claude Code",codex:"Codex"};function fg(e,t=Date.now()){const n=t-new Date(e).getTime(),r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const o=Math.floor(r/60);if(o<24)return`${o}h ago`;const c=Math.floor(o/24);return c<7?`${c}d ago`:new Date(e).toLocaleDateString([],{month:"short",day:"numeric"})}function x5(e,t){const n=new Date(t).getTime()-new Date(e).getTime();if(!Number.isFinite(n)||n<=0)return null;const r=Math.floor(n/6e4);if(r<1)return"under a minute";if(r<60)return`${r}m`;const o=Math.floor(r/60);return o<24?`${o}h ${r%60}m`:`${Math.floor(o/24)}d ${o%24}h`}function B1(e){return e.resumeMode===void 0?"checking":e.resumeMode==="agent-resume"?"resume":(e.turnCount??e.messageCount??0)>0?"from-summary":"empty"}function C5(e){switch(e){case"resume":return null;case"from-summary":return"from summary";case"empty":return"nothing recorded";case"checking":return"checking…"}}function Nv(e,t=Date.now(),n={}){const r=[];n.includeHarness!==!1&&r.push(tc[e.harness]),e.gitBranch&&r.push(e.gitBranch);const o=e.turnCount??e.messageCount;o!=null&&o>0&&r.push(`${o} ${o===1?"turn":"turns"}`);const c=n.state?C5(n.state):null;return c&&r.push(c),r.push(fg(e.lastActiveAt,t)),r.join(" · ")}function XC(e,t){const[n,r]=U.useState(e===null?{status:"empty"}:{status:"loading"});return U.useEffect(()=>{if(e===null){r({status:"empty"});return}let o=!1;return r({status:"loading"}),t(e).then(c=>{o||r(c?{status:"ready",record:c}:{status:"empty"})},c=>{o||r({status:"error",message:c instanceof Error?c.message:String(c)})}),()=>{o=!0}},[e,t]),n}function JC({text:e}){const t=e.split(`
|
|
470
|
-
`),n=[];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++,n.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}`;n.push(h.jsx(S,{className:"chat-heading",children:f(d[2])},c())),r++;continue}if(l.startsWith("> ")){n.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++}n.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++}n.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++;n.push(h.jsx("p",{className:"chat-paragraph",children:f(y.join(" "))},c()))}return h.jsx(h.Fragment,{children:n})}const H1={"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."},E5=["assistant-narration-gap","truncated-tool-output","missing-assistant-text","incomplete-final-turn","compacted-archive","dropped-early-turns"];function k5(e){const t=new Set(e),n=E5.filter(o=>t.has(o)).map(o=>H1[o]),r=[...t].filter(o=>!(o in H1)).map(o=>`Known gap reported by the harness: ${o}.`);return[...n,...r]}function j5(e){if(!e)return null;const t=[];return e.inputTokens!=null&&t.push(`${z1(e.inputTokens)} in`),e.outputTokens!=null&&t.push(`${z1(e.outputTokens)} out`),t.length>0?t.join(" · "):null}function z1(e){if(e<1e3)return String(e);const t=e/1e3;return`${t<100?t.toFixed(1):Math.round(t)}k`}function ZC(e,t=Date.now()){if(!e)return null;const n=new Date(e);if(Number.isNaN(n.getTime()))return null;const r=n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),o=new Date(t);return n.getFullYear()===o.getFullYear()&&n.getMonth()===o.getMonth()&&n.getDate()===o.getDate()?r:`${n.toLocaleDateString([],{day:"numeric",month:"short"})}, ${r}`}function A5(e,t){const n=e??"unknown tool";if(!t)return n;const r=t.replace(/\s+/g," ").trim();if(!r)return n;const o=r.length>80?`${r.slice(0,80)}…`:r;return`${n} · ${o}`}function R5({record:e}){const t=k5(e.limitations),n=ZC(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:n?`Archived copy from ${n}, kept after this session's raw events aged out of the local log.`:"Archived copy, kept after this session's raw events aged out of the local log."}),t.length>0&&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(T5,{turn:r},r.index))})]})}function T5({turn:e}){const t=j5(e.usage),n=ZC(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"}),n&&h.jsx("span",{className:"transcript-time",children:n})]}),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(N5,{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(JC,{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 N5({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:A5(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 U1(e){return e.agentSessionId==null?"This session can't be resumed: it exited before establishing a session id.":`${tc[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 M5({session:e,resumeMode:t,loadRecord:n,onResume:r,onContinue:o,onClose:c}){const f=e.agentSessionId!=null&&t!=="rehydrate",l=x5(e.createdAt,e.lastActiveAt),d=XC(e.id,n),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,...Ft({surface:"session_history"}),children:[h.jsxs("div",{className:"dead-session-summary",...Ft({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:tc[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:fg(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:U1(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:[U1(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(QC,{state:d})})]})}function O5({summary:e,loadRecord:t,onStart:n,onClose:r}){const o=e.resumeMode==="agent-resume",c=e.harnessSessionId??e.agentSessionId,f=XC(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:[Nv(e)," · ",e.cwd]})]}),h.jsxs("div",{className:"dead-session-actions",children:[h.jsx("button",{className:"btn-primary","data-testid":"past-session-start",onClick:n,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:[tc[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(QC,{state:f})})]})}function QC({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(R5,{record:e.record})}function D5({onCancel:e,onConfirm:t,triggerRef:n}){const r=U.useRef(null);return bo(!0,{onDismiss:e,containerRef:r,triggerRef:n}),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 $5(e){return br(e)}function L5({overviewMode:e=!1,openedAgentName:t=null,reviewTitle:n=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,sessions:p=[],onSelectSession:_=null,labelOf:k}){const[j,C]=U.useState(!1),[T,A]=U.useState(!1),[M,L]=U.useState(!1),[B,q]=U.useState(""),F=U.useRef(null),J=()=>A(!1),te=()=>{c&&l(c.id,B),L(!1)},W=c?p.filter(ee=>ee.id!==c.id):[],se=c?[c,...W]:[];return h.jsxs("div",{className:"session-bar",...Ft({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"})]}):n?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:n}),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?h.jsx(h.Fragment,{children:h.jsxs("div",{className:"session-current-wrap",children:[M?h.jsx("input",{className:"group-name-input session-rename-input session-context-rename","data-testid":"session-rename-input",value:B,autoFocus:!0,onFocus:ee=>ee.currentTarget.select(),onChange:ee=>q(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&te(),ee.key==="Escape"&&L(!1)},onBlur:te}):h.jsxs("button",{ref:F,className:"session-current session-title-trigger","data-testid":"session-menu","aria-haspopup":"menu","aria-expanded":T,"data-tooltip":`${tc[c.harness]} · ${$5(c.cwd)} · ${c.cwd}`,onClick:()=>A(ee=>!ee),...Ft({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}),h.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:k?k(c):f??c.title}),h.jsx(de,{name:"ChevronDown",size:13})]}),h.jsxs(fn,{open:T,anchorRef:F,onDismiss:J,placement:"down-start",className:"session-menu",role:"menu",testid:"session-menu-popover",children:[h.jsx("div",{className:"session-menu-section",children:"Sessions"}),se.map(ee=>{const H=ee.id===c.id;return h.jsxs("button",{role:"menuitemradio","aria-checked":H,className:"profile-menu-item session-switch-item"+(H?" is-selected":""),"data-testid":`session-switch-${ee.id}`,onClick:()=>{H||_==null||_(ee.id),J()},children:[h.jsx("span",{className:"session-dot","data-status":ee.status}),h.jsx("span",{className:"session-switch-label",children:k?k(ee):ee.title}),h.jsx("span",{className:"session-switch-meta",children:fg(ee.lastActiveAt)}),H&&h.jsx(de,{name:"Check",size:13})]},ee.id)}),b&&h.jsxs("button",{role:"menuitem",className:"profile-menu-item session-menu-new","data-testid":"session-new-menu",onClick:()=>{b(),J()},children:[h.jsx(de,{name:"Plus",size:13}),"New session"]}),h.jsx("div",{className:"session-menu-divider",role:"separator"}),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 ee;(ee=navigator.clipboard)==null||ee.writeText(c.cwd).then(()=>x("Path copied.","success")).catch(()=>x("Couldn't copy the path.")),J()},children:[h.jsx(de,{name:"Copy",size:13}),"Copy path"]}),h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"session-rename",onClick:()=>{q(f??c.title),L(!0),J()},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),J()},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:()=>{J(),C(!0)},children:[h.jsx(de,{name:"X",size:13}),"End session…"]})]})]})}):h.jsx("span",{className:"session-context-none",children:"No active session"})}),b&&c&&!r&&h.jsx("button",{className:"session-new","data-testid":"session-new","aria-label":"New session","data-tooltip":"New session",onClick:b,children:h.jsx(de,{name:"Plus",size:15})}),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(D5,{triggerRef:F,onCancel:()=>C(!1),onConfirm:()=>{C(!1),S(c.id)}})]})}const q1={deploy:"deploy",prod_run:"prod-run",run_local:"run-local"};function e2(e){return Object.prototype.hasOwnProperty.call(q1,e)?q1[e]:null}function I5(e){return e2(e.id)===null&&e.action.kind==="inject"}function P5(e,t,n){if(e.requiresWorkflow){if(!t)return"Select an agent first";if(e.action.kind==="open-url"&&e.action.url.includes("{{workflow.definitionId}}")&&t.definitionId==null)return"Not deployed yet"}return e.action.kind!=="open-url"&&!n?"Start a session first":null}function B5(e,t){return e.replace("{{workflow.definitionId}}",String((t==null?void 0:t.definitionId)??""))}var Tu={exports:{}},Sm={},Dn={},Jr={},wm={},xm={},Cm={},F1;function fh(){return F1||(F1=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends t{constructor(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=n;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 n&&(_[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 n?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 n||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 n))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})(Cm)),Cm}var Em={},V1;function W1(){return V1||(V1=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=fh();class n 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 n(b);g.set(b,r.Completed)})}return w}}e.ValueScope=l})(Em)),Em}var G1;function ft(){return G1||(G1=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=fh(),n=W1();var r=fh();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=W1();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(I,G){return this}}class f extends c{constructor(I,G,ie){super(),this.varKind=I,this.name=G,this.rhs=ie}render({es5:I,_n:G}){const ie=I?n.varKinds.var:this.varKind,X=this.rhs===void 0?"":` = ${this.rhs}`;return`${ie} ${this.name}${X};`+G}optimizeNames(I,G){if(I[this.name.str])return this.rhs&&(this.rhs=J(this.rhs,I,G)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class l extends c{constructor(I,G,ie){super(),this.lhs=I,this.rhs=G,this.sideEffects=ie}render({_n:I}){return`${this.lhs} = ${this.rhs};`+I}optimizeNames(I,G){if(!(this.lhs instanceof t.Name&&!I[this.lhs.str]&&!this.sideEffects))return this.rhs=J(this.rhs,I,G),this}get names(){const I=this.lhs instanceof t.Name?{}:{...this.lhs.names};return F(I,this.rhs)}}class d extends l{constructor(I,G,ie,X){super(I,ie,X),this.op=G}render({_n:I}){return`${this.lhs} ${this.op}= ${this.rhs};`+I}}class m extends c{constructor(I){super(),this.label=I,this.names={}}render({_n:I}){return`${this.label}:`+I}}class y extends c{constructor(I){super(),this.label=I,this.names={}}render({_n:I}){return`break${this.label?` ${this.label}`:""};`+I}}class v extends c{constructor(I){super(),this.error=I}render({_n:I}){return`throw ${this.error};`+I}get names(){return this.error.names}}class S extends c{constructor(I){super(),this.code=I}render({_n:I}){return`${this.code};`+I}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(I,G){return this.code=J(this.code,I,G),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class w extends c{constructor(I=[]){super(),this.nodes=I}render(I){return this.nodes.reduce((G,ie)=>G+ie.render(I),"")}optimizeNodes(){const{nodes:I}=this;let G=I.length;for(;G--;){const ie=I[G].optimizeNodes();Array.isArray(ie)?I.splice(G,1,...ie):ie?I[G]=ie:I.splice(G,1)}return I.length>0?this:void 0}optimizeNames(I,G){const{nodes:ie}=this;let X=ie.length;for(;X--;){const V=ie[X];V.optimizeNames(I,G)||(te(I,V.names),ie.splice(X,1))}return ie.length>0?this:void 0}get names(){return this.nodes.reduce((I,G)=>q(I,G.names),{})}}class R extends w{render(I){return"{"+I._n+super.render(I)+"}"+I._n}}class x extends w{}class g extends R{}g.kind="else";class b extends R{constructor(I,G){super(G),this.condition=I}render(I){let G=`if(${this.condition})`+super.render(I);return this.else&&(G+="else "+this.else.render(I)),G}optimizeNodes(){super.optimizeNodes();const I=this.condition;if(I===!0)return this.nodes;let G=this.else;if(G){const ie=G.optimizeNodes();G=this.else=Array.isArray(ie)?new g(ie):ie}if(G)return I===!1?G instanceof b?G:G.nodes:this.nodes.length?this:new b(W(I),G instanceof b?[G]:G.nodes);if(!(I===!1||!this.nodes.length))return this}optimizeNames(I,G){var ie;if(this.else=(ie=this.else)===null||ie===void 0?void 0:ie.optimizeNames(I,G),!!(super.optimizeNames(I,G)||this.else))return this.condition=J(this.condition,I,G),this}get names(){const I=super.names;return F(I,this.condition),this.else&&q(I,this.else.names),I}}b.kind="if";class p extends R{}p.kind="for";class _ extends p{constructor(I){super(),this.iteration=I}render(I){return`for(${this.iteration})`+super.render(I)}optimizeNames(I,G){if(super.optimizeNames(I,G))return this.iteration=J(this.iteration,I,G),this}get names(){return q(super.names,this.iteration.names)}}class k extends p{constructor(I,G,ie,X){super(),this.varKind=I,this.name=G,this.from=ie,this.to=X}render(I){const G=I.es5?n.varKinds.var:this.varKind,{name:ie,from:X,to:V}=this;return`for(${G} ${ie}=${X}; ${ie}<${V}; ${ie}++)`+super.render(I)}get names(){const I=F(super.names,this.from);return F(I,this.to)}}class j extends p{constructor(I,G,ie,X){super(),this.loop=I,this.varKind=G,this.name=ie,this.iterable=X}render(I){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(I)}optimizeNames(I,G){if(super.optimizeNames(I,G))return this.iterable=J(this.iterable,I,G),this}get names(){return q(super.names,this.iterable.names)}}class C extends R{constructor(I,G,ie){super(),this.name=I,this.args=G,this.async=ie}render(I){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(I)}}C.kind="func";class T extends w{render(I){return"return "+super.render(I)}}T.kind="return";class A extends R{render(I){let G="try"+super.render(I);return this.catch&&(G+=this.catch.render(I)),this.finally&&(G+=this.finally.render(I)),G}optimizeNodes(){var I,G;return super.optimizeNodes(),(I=this.catch)===null||I===void 0||I.optimizeNodes(),(G=this.finally)===null||G===void 0||G.optimizeNodes(),this}optimizeNames(I,G){var ie,X;return super.optimizeNames(I,G),(ie=this.catch)===null||ie===void 0||ie.optimizeNames(I,G),(X=this.finally)===null||X===void 0||X.optimizeNames(I,G),this}get names(){const I=super.names;return this.catch&&q(I,this.catch.names),this.finally&&q(I,this.finally.names),I}}class M extends R{constructor(I){super(),this.error=I}render(I){return`catch(${this.error})`+super.render(I)}}M.kind="catch";class L extends R{render(I){return"finally"+super.render(I)}}L.kind="finally";class B{constructor(I,G={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...G,_n:G.lines?`
|
|
472
|
-
`:""},this._extScope=I,this._scope=new n.Scope({parent:I}),this._nodes=[new x]}toString(){return this._root.render(this.opts)}name(I){return this._scope.name(I)}scopeName(I){return this._extScope.name(I)}scopeValue(I,G){const ie=this._extScope.value(I,G);return(this._values[ie.prefix]||(this._values[ie.prefix]=new Set)).add(ie),ie}getScopeValue(I,G){return this._extScope.getValue(I,G)}scopeRefs(I){return this._extScope.scopeRefs(I,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(I,G,ie,X){const V=this._scope.toName(G);return ie!==void 0&&X&&(this._constants[V.str]=ie),this._leafNode(new f(I,V,ie)),V}const(I,G,ie){return this._def(n.varKinds.const,I,G,ie)}let(I,G,ie){return this._def(n.varKinds.let,I,G,ie)}var(I,G,ie){return this._def(n.varKinds.var,I,G,ie)}assign(I,G,ie){return this._leafNode(new l(I,G,ie))}add(I,G){return this._leafNode(new d(I,e.operators.ADD,G))}code(I){return typeof I=="function"?I():I!==t.nil&&this._leafNode(new S(I)),this}object(...I){const G=["{"];for(const[ie,X]of I)G.length>1&&G.push(","),G.push(ie),(ie!==X||this.opts.es5)&&(G.push(":"),(0,t.addCodeArg)(G,X));return G.push("}"),new t._Code(G)}if(I,G,ie){if(this._blockNode(new b(I)),G&&ie)this.code(G).else().code(ie).endIf();else if(G)this.code(G).endIf();else if(ie)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(I){return this._elseNode(new b(I))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(b,g)}_for(I,G){return this._blockNode(I),G&&this.code(G).endFor(),this}for(I,G){return this._for(new _(I),G)}forRange(I,G,ie,X,V=this.opts.es5?n.varKinds.var:n.varKinds.let){const ce=this._scope.toName(I);return this._for(new k(V,ce,G,ie),()=>X(ce))}forOf(I,G,ie,X=n.varKinds.const){const V=this._scope.toName(I);if(this.opts.es5){const ce=G instanceof t.Name?G:this.var("_arr",G);return this.forRange("_i",0,(0,t._)`${ce}.length`,ae=>{this.var(V,(0,t._)`${ce}[${ae}]`),ie(V)})}return this._for(new j("of",X,V,G),()=>ie(V))}forIn(I,G,ie,X=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(I,(0,t._)`Object.keys(${G})`,ie);const V=this._scope.toName(I);return this._for(new j("in",X,V,G),()=>ie(V))}endFor(){return this._endBlockNode(p)}label(I){return this._leafNode(new m(I))}break(I){return this._leafNode(new y(I))}return(I){const G=new T;if(this._blockNode(G),this.code(I),G.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(T)}try(I,G,ie){if(!G&&!ie)throw new Error('CodeGen: "try" without "catch" and "finally"');const X=new A;if(this._blockNode(X),this.code(I),G){const V=this.name("e");this._currNode=X.catch=new M(V),G(V)}return ie&&(this._currNode=X.finally=new L,this.code(ie)),this._endBlockNode(M,L)}throw(I){return this._leafNode(new v(I))}block(I,G){return this._blockStarts.push(this._nodes.length),I&&this.code(I).endBlock(G),this}endBlock(I){const G=this._blockStarts.pop();if(G===void 0)throw new Error("CodeGen: not in self-balancing block");const ie=this._nodes.length-G;if(ie<0||I!==void 0&&ie!==I)throw new Error(`CodeGen: wrong number of nodes: ${ie} vs ${I} expected`);return this._nodes.length=G,this}func(I,G=t.nil,ie,X){return this._blockNode(new C(I,G,ie)),X&&this.code(X).endFunc(),this}endFunc(){return this._endBlockNode(C)}optimize(I=1){for(;I-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(I){return this._currNode.nodes.push(I),this}_blockNode(I){this._currNode.nodes.push(I),this._nodes.push(I)}_endBlockNode(I,G){const ie=this._currNode;if(ie instanceof I||G&&ie instanceof G)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${G?`${I.kind}/${G.kind}`:I.kind}"`)}_elseNode(I){const G=this._currNode;if(!(G instanceof b))throw new Error('CodeGen: "else" without "if"');return this._currNode=G.else=I,this}get _root(){return this._nodes[0]}get _currNode(){const I=this._nodes;return I[I.length-1]}set _currNode(I){const G=this._nodes;G[G.length-1]=I}}e.CodeGen=B;function q(z,I){for(const G in I)z[G]=(z[G]||0)+(I[G]||0);return z}function F(z,I){return I instanceof t._CodeOrName?q(z,I.names):z}function J(z,I,G){if(z instanceof t.Name)return ie(z);if(!X(z))return z;return new t._Code(z._items.reduce((V,ce)=>(ce instanceof t.Name&&(ce=ie(ce)),ce instanceof t._Code?V.push(...ce._items):V.push(ce),V),[]));function ie(V){const ce=G[V.str];return ce===void 0||I[V.str]!==1?V:(delete I[V.str],ce)}function X(V){return V instanceof t._Code&&V._items.some(ce=>ce instanceof t.Name&&I[ce.str]===1&&G[ce.str]!==void 0)}}function te(z,I){for(const G in I)z[G]=(z[G]||0)-(I[G]||0)}function W(z){return typeof z=="boolean"||typeof z=="number"||z===null?!z:(0,t._)`!${P(z)}`}e.not=W;const se=O(e.operators.AND);function ee(...z){return z.reduce(se)}e.and=ee;const H=O(e.operators.OR);function $(...z){return z.reduce(H)}e.or=$;function O(z){return(I,G)=>I===t.nil?G:G===t.nil?I:(0,t._)`${P(I)} ${z} ${P(G)}`}function P(z){return z instanceof t.Name?z:(0,t._)`(${z})`}})(xm)),xm}var pt={},K1;function wt(){if(K1)return pt;K1=1,Object.defineProperty(pt,"__esModule",{value:!0}),pt.checkStrictMode=pt.getErrorPath=pt.Type=pt.useFunc=pt.setEvaluated=pt.evaluatedPropsToName=pt.mergeEvaluated=pt.eachItem=pt.unescapeJsonPointer=pt.escapeJsonPointer=pt.escapeFragment=pt.unescapeFragment=pt.schemaRefOrVal=pt.schemaHasRulesButRef=pt.schemaHasRules=pt.checkUnknownRules=pt.alwaysValidSchema=pt.toHash=void 0;const e=ft(),t=fh();function n(j){const C={};for(const T of j)C[T]=!0;return C}pt.toHash=n;function r(j,C){return typeof C=="boolean"?C:Object.keys(C).length===0?!0:(o(j,C),!c(C,j.self.RULES.all))}pt.alwaysValidSchema=r;function o(j,C=j.schema){const{opts:T,self:A}=j;if(!T.strictSchema||typeof C=="boolean")return;const M=A.RULES.keywords;for(const L in C)M[L]||k(j,`unknown keyword: "${L}"`)}pt.checkUnknownRules=o;function c(j,C){if(typeof j=="boolean")return!j;for(const T in j)if(C[T])return!0;return!1}pt.schemaHasRules=c;function f(j,C){if(typeof j=="boolean")return!j;for(const T in j)if(T!=="$ref"&&C.all[T])return!0;return!1}pt.schemaHasRulesButRef=f;function l({topSchemaRef:j,schemaPath:C},T,A,M){if(!M){if(typeof T=="number"||typeof T=="boolean")return T;if(typeof T=="string")return(0,e._)`${T}`}return(0,e._)`${j}${C}${(0,e.getProperty)(A)}`}pt.schemaRefOrVal=l;function d(j){return v(decodeURIComponent(j))}pt.unescapeFragment=d;function m(j){return encodeURIComponent(y(j))}pt.escapeFragment=m;function y(j){return typeof j=="number"?`${j}`:j.replace(/~/g,"~0").replace(/\//g,"~1")}pt.escapeJsonPointer=y;function v(j){return j.replace(/~1/g,"/").replace(/~0/g,"~")}pt.unescapeJsonPointer=v;function S(j,C){if(Array.isArray(j))for(const T of j)C(T);else C(j)}pt.eachItem=S;function w({mergeNames:j,mergeToName:C,mergeValues:T,resultToName:A}){return(M,L,B,q)=>{const F=B===void 0?L:B instanceof e.Name?(L instanceof e.Name?j(M,L,B):C(M,L,B),B):L instanceof e.Name?(C(M,B,L),L):T(L,B);return q===e.Name&&!(F instanceof e.Name)?A(M,F):F}}pt.mergeEvaluated={props:w({mergeNames:(j,C,T)=>j.if((0,e._)`${T} !== true && ${C} !== undefined`,()=>{j.if((0,e._)`${C} === true`,()=>j.assign(T,!0),()=>j.assign(T,(0,e._)`${T} || {}`).code((0,e._)`Object.assign(${T}, ${C})`))}),mergeToName:(j,C,T)=>j.if((0,e._)`${T} !== true`,()=>{C===!0?j.assign(T,!0):(j.assign(T,(0,e._)`${T} || {}`),x(j,T,C))}),mergeValues:(j,C)=>j===!0?!0:{...j,...C},resultToName:R}),items:w({mergeNames:(j,C,T)=>j.if((0,e._)`${T} !== true && ${C} !== undefined`,()=>j.assign(T,(0,e._)`${C} === true ? true : ${T} > ${C} ? ${T} : ${C}`)),mergeToName:(j,C,T)=>j.if((0,e._)`${T} !== true`,()=>j.assign(T,C===!0?!0:(0,e._)`${T} > ${C} ? ${T} : ${C}`)),mergeValues:(j,C)=>j===!0?!0:Math.max(j,C),resultToName:(j,C)=>j.var("items",C)})};function R(j,C){if(C===!0)return j.var("props",!0);const T=j.var("props",(0,e._)`{}`);return C!==void 0&&x(j,T,C),T}pt.evaluatedPropsToName=R;function x(j,C,T){Object.keys(T).forEach(A=>j.assign((0,e._)`${C}${(0,e.getProperty)(A)}`,!0))}pt.setEvaluated=x;const g={};function b(j,C){return j.scopeValue("func",{ref:C,code:g[C.code]||(g[C.code]=new t._Code(C.code))})}pt.useFunc=b;var p;(function(j){j[j.Num=0]="Num",j[j.Str=1]="Str"})(p||(pt.Type=p={}));function _(j,C,T){if(j instanceof e.Name){const A=C===p.Num;return T?A?(0,e._)`"[" + ${j} + "]"`:(0,e._)`"['" + ${j} + "']"`:A?(0,e._)`"/" + ${j}`:(0,e._)`"/" + ${j}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return T?(0,e.getProperty)(j).toString():"/"+y(j)}pt.getErrorPath=_;function k(j,C,T=j.opts.strictSchema){if(T){if(C=`strict mode: ${C}`,T===!0)throw new Error(C);j.self.logger.warn(C)}}return pt.checkStrictMode=k,pt}var Nu={},Y1;function en(){if(Y1)return Nu;Y1=1,Object.defineProperty(Nu,"__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 Nu.default=t,Nu}var X1;function Ch(){return X1||(X1=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(),n=wt(),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:j,compositeRule:C,allErrors:T}=k,A=v(g,b,p);_??(C||T)?d(j,A):m(k,(0,t._)`[${A}]`)}e.reportError=o;function c(g,b=e.keywordError,p){const{it:_}=g,{gen:k,compositeRule:j,allErrors:C}=_,T=v(g,b,p);d(k,T),j||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:j}){if(k===void 0)throw new Error("ajv implementation error");const C=g.name("err");g.forRange("i",k,r.default.errors,T=>{g.const(C,(0,t._)`${r.default.vErrors}[${T}]`),g.if((0,t._)`${C}.instancePath === undefined`,()=>g.assign((0,t._)`${C}.instancePath`,(0,t.strConcat)(r.default.instancePath,j.errorPath))),g.assign((0,t._)`${C}.schemaPath`,(0,t.str)`${j.errSchemaPath}/${b}`),j.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,j=[w(k,p),R(g,p)];return x(g,b,j),_.object(...j)}function w({errorPath:g},{instancePath:b}){const p=b?(0,t.str)`${g}${(0,n.getErrorPath)(b,n.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,n.getErrorPath)(p,n.Type.Str)}`),[y.schemaPath,k]}function x(g,{params:b,message:p},_){const{keyword:k,data:j,schemaValue:C,it:T}=g,{opts:A,propertyName:M,topSchemaRef:L,schemaPath:B}=T;_.push([y.keyword,k],[y.params,typeof b=="function"?b(g):b||(0,t._)`{}`]),A.messages&&_.push([y.message,typeof p=="function"?p(g):p]),A.verbose&&_.push([y.schema,C],[y.parentSchema,(0,t._)`${L}${B}`],[r.default.data,j]),M&&_.push([y.propertyName,M])}})(wm)),wm}var J1;function H5(){if(J1)return Jr;J1=1,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.boolOrEmptySchema=Jr.topBoolOrEmptySchema=void 0;const e=Ch(),t=ft(),n=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(n.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 Us={},Zr={},Z1;function t2(){if(Z1)return Zr;Z1=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 n(o){return typeof o=="string"&&t.has(o)}Zr.isJSONType=n;function r(){const o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}return Zr.getRules=r,Zr}var $n={},Q1;function s2(){if(Q1)return $n;Q1=1,Object.defineProperty($n,"__esModule",{value:!0}),$n.shouldUseRule=$n.shouldUseGroup=$n.schemaHasRulesForType=void 0;function e({schema:r,self:o},c){const f=o.RULES.types[c];return f&&f!==!0&&t(r,f)}$n.schemaHasRulesForType=e;function t(r,o){return o.rules.some(c=>n(r,c))}$n.shouldUseGroup=t;function n(r,o){var c;return r[o.keyword]!==void 0||((c=o.definition.implements)===null||c===void 0?void 0:c.some(f=>r[f]!==void 0))}return $n.shouldUseRule=n,$n}var eS;function ph(){if(eS)return Us;eS=1,Object.defineProperty(Us,"__esModule",{value:!0}),Us.reportTypeError=Us.checkDataTypes=Us.checkDataType=Us.coerceAndCheckDataType=Us.getJSONTypes=Us.getSchemaTypes=Us.DataType=void 0;const e=t2(),t=s2(),n=Ch(),r=ft(),o=wt();var c;(function(p){p[p.Correct=0]="Correct",p[p.Wrong=1]="Wrong"})(c||(Us.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 _}Us.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(","))}Us.getJSONTypes=l;function d(p,_){const{gen:k,data:j,opts:C}=p,T=y(_,C.coerceTypes),A=_.length>0&&!(T.length===0&&_.length===1&&(0,t.schemaHasRulesForType)(p,_[0]));if(A){const M=R(_,j,C.strictNumbers,c.Wrong);k.if(M,()=>{T.length?v(p,_,T):g(p)})}return A}Us.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:j,data:C,opts:T}=p,A=j.let("dataType",(0,r._)`typeof ${C}`),M=j.let("coerced",(0,r._)`undefined`);T.coerceTypes==="array"&&j.if((0,r._)`${A} == 'object' && Array.isArray(${C}) && ${C}.length == 1`,()=>j.assign(C,(0,r._)`${C}[0]`).assign(A,(0,r._)`typeof ${C}`).if(R(_,C,T.strictNumbers),()=>j.assign(M,C))),j.if((0,r._)`${M} !== undefined`);for(const B of k)(m.has(B)||B==="array"&&T.coerceTypes==="array")&&L(B);j.else(),g(p),j.endIf(),j.if((0,r._)`${M} !== undefined`,()=>{j.assign(C,M),S(p,M)});function L(B){switch(B){case"string":j.elseIf((0,r._)`${A} == "number" || ${A} == "boolean"`).assign(M,(0,r._)`"" + ${C}`).elseIf((0,r._)`${C} === null`).assign(M,(0,r._)`""`);return;case"number":j.elseIf((0,r._)`${A} == "boolean" || ${C} === null
|
|
473
|
-
|| (${A} == "string" && ${C} && ${C} == +${C})`).assign(M,(0,r._)`+${C}`);return;case"integer":j.elseIf((0,r._)`${A} === "boolean" || ${C} === null
|
|
474
|
-
|| (${A} === "string" && ${C} && ${C} == +${C} && !(${C} % 1))`).assign(M,(0,r._)`+${C}`);return;case"boolean":j.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":j.elseIf((0,r._)`${C} === "" || ${C} === 0 || ${C} === false`),j.assign(M,null);return;case"array":j.elseIf((0,r._)`${A} === "string" || ${A} === "number"
|
|
475
|
-
|| ${A} === "boolean" || ${C} === null`).assign(M,(0,r._)`[${C}]`)}}}function S({gen:p,parentData:_,parentDataProperty:k},j){p.if((0,r._)`${_} !== undefined`,()=>p.assign((0,r._)`${_}[${k}]`,j))}function w(p,_,k,j=c.Correct){const C=j===c.Correct?r.operators.EQ:r.operators.NEQ;let T;switch(p){case"null":return(0,r._)`${_} ${C} null`;case"array":T=(0,r._)`Array.isArray(${_})`;break;case"object":T=(0,r._)`${_} && typeof ${_} == "object" && !Array.isArray(${_})`;break;case"integer":T=A((0,r._)`!(${_} % 1) && !isNaN(${_})`);break;case"number":T=A();break;default:return(0,r._)`typeof ${_} ${C} ${p}`}return j===c.Correct?T:(0,r.not)(T);function A(M=r.nil){return(0,r.and)((0,r._)`typeof ${_} == "number"`,M,k?(0,r._)`isFinite(${_})`:r.nil)}}Us.checkDataType=w;function R(p,_,k,j){if(p.length===1)return w(p[0],_,k,j);let C;const T=(0,o.toHash)(p);if(T.array&&T.object){const A=(0,r._)`typeof ${_} != "object"`;C=T.null?A:(0,r._)`!${_} || ${A}`,delete T.null,delete T.array,delete T.object}else C=r.nil;T.number&&delete T.integer;for(const A in T)C=(0,r.and)(C,w(A,_,k,j));return C}Us.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,n.reportError)(_,x)}Us.reportTypeError=g;function b(p){const{gen:_,data:k,schema:j}=p,C=(0,o.schemaRefOrVal)(p,j,"type");return{gen:_,keyword:"type",data:k,schema:j.type,schemaCode:C,schemaValue:C,parentSchema:j,params:{},it:p}}return Us}var jl={},tS;function z5(){if(tS)return jl;tS=1,Object.defineProperty(jl,"__esModule",{value:!0}),jl.assignDefaults=void 0;const e=ft(),t=wt();function n(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))}jl.assignDefaults=n;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 jl}var Xi={},zt={},sS;function tn(){if(sS)return zt;sS=1,Object.defineProperty(zt,"__esModule",{value:!0}),zt.validateUnion=zt.validateArray=zt.usePattern=zt.callValidateCode=zt.schemaProperties=zt.allSchemaProperties=zt.noPropertyInData=zt.propertyInData=zt.isOwnProperty=zt.hasPropFunc=zt.reportMissingProp=zt.checkMissingProp=zt.checkReportMissingProp=void 0;const e=ft(),t=wt(),n=en(),r=wt();function o(p,_){const{gen:k,data:j,it:C}=p;k.if(y(k,j,_,C.opts.ownProperties),()=>{p.setParams({missingProperty:(0,e._)`${_}`},!0),p.error()})}zt.checkReportMissingProp=o;function c({gen:p,data:_,it:{opts:k}},j,C){return(0,e.or)(...j.map(T=>(0,e.and)(y(p,_,T,k.ownProperties),(0,e._)`${C} = ${T}`)))}zt.checkMissingProp=c;function f(p,_){p.setParams({missingProperty:_},!0),p.error()}zt.reportMissingProp=f;function l(p){return p.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,e._)`Object.prototype.hasOwnProperty`})}zt.hasPropFunc=l;function d(p,_,k){return(0,e._)`${l(p)}.call(${_}, ${k})`}zt.isOwnProperty=d;function m(p,_,k,j){const C=(0,e._)`${_}${(0,e.getProperty)(k)} !== undefined`;return j?(0,e._)`${C} && ${d(p,_,k)}`:C}zt.propertyInData=m;function y(p,_,k,j){const C=(0,e._)`${_}${(0,e.getProperty)(k)} === undefined`;return j?(0,e.or)(C,(0,e.not)(d(p,_,k))):C}zt.noPropertyInData=y;function v(p){return p?Object.keys(p).filter(_=>_!=="__proto__"):[]}zt.allSchemaProperties=v;function S(p,_){return v(_).filter(k=>!(0,t.alwaysValidSchema)(p,_[k]))}zt.schemaProperties=S;function w({schemaCode:p,data:_,it:{gen:k,topSchemaRef:j,schemaPath:C,errorPath:T},it:A},M,L,B){const q=B?(0,e._)`${p}, ${_}, ${j}${C}`:_,F=[[n.default.instancePath,(0,e.strConcat)(n.default.instancePath,T)],[n.default.parentData,A.parentData],[n.default.parentDataProperty,A.parentDataProperty],[n.default.rootData,n.default.rootData]];A.opts.dynamicRef&&F.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);const J=(0,e._)`${q}, ${k.object(...F)}`;return L!==e.nil?(0,e._)`${M}.call(${L}, ${J})`:(0,e._)`${M}(${J})`}zt.callValidateCode=w;const R=(0,e._)`new RegExp`;function x({gen:p,it:{opts:_}},k){const j=_.unicodeRegExp?"u":"",{regExp:C}=_.code,T=C(k,j);return p.scopeValue("pattern",{key:T.toString(),ref:T,code:(0,e._)`${C.code==="new RegExp"?R:(0,r.useFunc)(p,C)}(${k}, ${j})`})}zt.usePattern=x;function g(p){const{gen:_,data:k,keyword:j,it:C}=p,T=_.name("valid");if(C.allErrors){const M=_.let("valid",!0);return A(()=>_.assign(M,!1)),M}return _.var(T,!0),A(()=>_.break()),T;function A(M){const L=_.const("len",(0,e._)`${k}.length`);_.forRange("i",0,L,B=>{p.subschema({keyword:j,dataProp:B,dataPropType:t.Type.Num},T),_.if((0,e.not)(T),M)})}}zt.validateArray=g;function b(p){const{gen:_,schema:k,keyword:j,it:C}=p;if(!Array.isArray(k))throw new Error("ajv implementation error");if(k.some(L=>(0,t.alwaysValidSchema)(C,L))&&!C.opts.unevaluated)return;const A=_.let("valid",!1),M=_.name("_valid");_.block(()=>k.forEach((L,B)=>{const q=p.subschema({keyword:j,schemaProp:B,compositeRule:!0},M);_.assign(A,(0,e._)`${A} || ${M}`),p.mergeValidEvaluated(q,M)||_.if((0,e.not)(A))})),p.result(A,()=>p.reset(),()=>p.error(!0))}return zt.validateUnion=b,zt}var iS;function U5(){if(iS)return Xi;iS=1,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.validateKeywordUsage=Xi.validSchemaType=Xi.funcKeywordCode=Xi.macroKeywordCode=void 0;const e=ft(),t=en(),n=tn(),r=Ch();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 j=R.name("valid");S.subschema({schema:_,schemaPath:e.nil,errSchemaPath:`${p.errSchemaPath}/${x}`,topSchemaRef:k,compositeRule:!0},j),S.pass(j,()=>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 j=!_&&w.compile?w.compile.call(k.self,b,p,k):w.validate,C=m(x,g,j),T=x.let("valid");S.block$data(T,A),S.ok((R=w.valid)!==null&&R!==void 0?R:T);function A(){if(w.errors===!1)B(),w.modifying&&f(S),q(()=>S.error());else{const F=w.async?M():L();w.modifying&&f(S),q(()=>l(S,F))}}function M(){const F=x.let("ruleErrs",null);return x.try(()=>B((0,e._)`await `),J=>x.assign(T,!1).if((0,e._)`${J} instanceof ${k.ValidationError}`,()=>x.assign(F,(0,e._)`${J}.errors`),()=>x.throw(J))),F}function L(){const F=(0,e._)`${C}.errors`;return x.assign(F,null),B(e.nil),F}function B(F=w.async?(0,e._)`await `:e.nil){const J=k.opts.passContext?t.default.this:t.default.self,te=!("compile"in w&&!_||w.schema===!1);x.assign(T,(0,e._)`${F}${(0,n.callValidateCode)(S,C,J,te)}`,w.modifying)}function q(F){var J;x.if((0,e.not)((J=w.valid)!==null&&J!==void 0?J:T),F)}}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 Ln={},nS;function q5(){if(nS)return Ln;nS=1,Object.defineProperty(Ln,"__esModule",{value:!0}),Ln.extendSubschemaMode=Ln.extendSubschemaData=Ln.getSubschema=void 0;const e=ft(),t=wt();function n(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')}Ln.getSubschema=n;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]}}Ln.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 Ln.extendSubschemaMode=o,Ln}var ti={},km,rS;function i2(){return rS||(rS=1,km=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,c;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(c=Object.keys(t),r=c.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,c[o]))return!1;for(o=r;o--!==0;){var f=c[o];if(!e(t[f],n[f]))return!1}return!0}return t!==t&&n!==n}),km}var jm={exports:{}},aS;function F5(){if(aS)return jm.exports;aS=1;var e=jm.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+"/"+n(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 n(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}return jm.exports}var oS;function Eh(){if(oS)return ti;oS=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.getSchemaRefs=ti.resolveUrl=ti.normalizeId=ti._getFullPath=ti.getFullPath=ti.inlineRef=void 0;const e=wt(),t=i2(),n=F5(),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}ti.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)}ti.getFullPath=d;function m(x,g){return x.serialize(g).split("#")[0]+"#"}ti._getFullPath=m;const y=/#\/?$/;function v(x){return x?x.replace(y,""):""}ti.normalizeId=v;function S(x,g,b){return b=v(b),x.resolve(g,b)}ti.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={"":_},j=d(p,_,!1),C={},T=new Set;return n(x,{allKeys:!0},(L,B,q,F)=>{if(F===void 0)return;const J=j+B;let te=k[F];typeof L[b]=="string"&&(te=W.call(this,L[b])),se.call(this,L.$anchor),se.call(this,L.$dynamicAnchor),k[B]=te;function W(ee){const H=this.opts.uriResolver.resolve;if(ee=v(te?H(te,ee):ee),T.has(ee))throw M(ee);T.add(ee);let $=this.refs[ee];return typeof $=="string"&&($=this.refs[$]),typeof $=="object"?A(L,$.schema,ee):ee!==v(J)&&(ee[0]==="#"?(A(L,C[ee],ee),C[ee]=L):this.refs[ee]=J),ee}function se(ee){if(typeof ee=="string"){if(!w.test(ee))throw new Error(`invalid anchor "${ee}"`);W.call(this,`#${ee}`)}}}),C;function A(L,B,q){if(B!==void 0&&!t(L,B))throw M(q)}function M(L){return new Error(`reference "${L}" resolves to more than one schema`)}}return ti.getSchemaRefs=R,ti}var lS;function kh(){if(lS)return Dn;lS=1,Object.defineProperty(Dn,"__esModule",{value:!0}),Dn.getData=Dn.KeywordCxt=Dn.validateFunctionCode=void 0;const e=H5(),t=ph(),n=s2(),r=ph(),o=z5(),c=U5(),f=q5(),l=ft(),d=en(),m=Eh(),y=wt(),v=Ch();function S(Y){if(j(Y)&&(T(Y),k(Y))){g(Y);return}w(Y,()=>(0,e.topBoolOrEmptySchema)(Y))}Dn.validateFunctionCode=S;function w({gen:Y,validateName:Z,schema:ue,schemaEnv:we,opts:Ae},Ie){Ae.code.es5?Y.func(Z,(0,l._)`${d.default.data}, ${d.default.valCxt}`,we.$async,()=>{Y.code((0,l._)`"use strict"; ${p(ue,Ae)}`),x(Y,Ae),Y.code(Ie)}):Y.func(Z,(0,l._)`${d.default.data}, ${R(Ae)}`,we.$async,()=>Y.code(p(ue,Ae)).code(Ie))}function R(Y){return(0,l._)`{${d.default.instancePath}="", ${d.default.parentData}, ${d.default.parentDataProperty}, ${d.default.rootData}=${d.default.data}${Y.dynamicRef?(0,l._)`, ${d.default.dynamicAnchors}={}`:l.nil}}={}`}function x(Y,Z){Y.if(d.default.valCxt,()=>{Y.var(d.default.instancePath,(0,l._)`${d.default.valCxt}.${d.default.instancePath}`),Y.var(d.default.parentData,(0,l._)`${d.default.valCxt}.${d.default.parentData}`),Y.var(d.default.parentDataProperty,(0,l._)`${d.default.valCxt}.${d.default.parentDataProperty}`),Y.var(d.default.rootData,(0,l._)`${d.default.valCxt}.${d.default.rootData}`),Z.dynamicRef&&Y.var(d.default.dynamicAnchors,(0,l._)`${d.default.valCxt}.${d.default.dynamicAnchors}`)},()=>{Y.var(d.default.instancePath,(0,l._)`""`),Y.var(d.default.parentData,(0,l._)`undefined`),Y.var(d.default.parentDataProperty,(0,l._)`undefined`),Y.var(d.default.rootData,d.default.data),Z.dynamicRef&&Y.var(d.default.dynamicAnchors,(0,l._)`{}`)})}function g(Y){const{schema:Z,opts:ue,gen:we}=Y;w(Y,()=>{ue.$comment&&Z.$comment&&F(Y),L(Y),we.let(d.default.vErrors,null),we.let(d.default.errors,0),ue.unevaluated&&b(Y),A(Y),J(Y)})}function b(Y){const{gen:Z,validateName:ue}=Y;Y.evaluated=Z.const("evaluated",(0,l._)`${ue}.evaluated`),Z.if((0,l._)`${Y.evaluated}.dynamicProps`,()=>Z.assign((0,l._)`${Y.evaluated}.props`,(0,l._)`undefined`)),Z.if((0,l._)`${Y.evaluated}.dynamicItems`,()=>Z.assign((0,l._)`${Y.evaluated}.items`,(0,l._)`undefined`))}function p(Y,Z){const ue=typeof Y=="object"&&Y[Z.schemaId];return ue&&(Z.code.source||Z.code.process)?(0,l._)`/*# sourceURL=${ue} */`:l.nil}function _(Y,Z){if(j(Y)&&(T(Y),k(Y))){C(Y,Z);return}(0,e.boolOrEmptySchema)(Y,Z)}function k({schema:Y,self:Z}){if(typeof Y=="boolean")return!Y;for(const ue in Y)if(Z.RULES.all[ue])return!0;return!1}function j(Y){return typeof Y.schema!="boolean"}function C(Y,Z){const{schema:ue,gen:we,opts:Ae}=Y;Ae.$comment&&ue.$comment&&F(Y),B(Y),q(Y);const Ie=we.const("_errs",d.default.errors);A(Y,Ie),we.var(Z,(0,l._)`${Ie} === ${d.default.errors}`)}function T(Y){(0,y.checkUnknownRules)(Y),M(Y)}function A(Y,Z){if(Y.opts.jtd)return W(Y,[],!1,Z);const ue=(0,t.getSchemaTypes)(Y.schema),we=(0,t.coerceAndCheckDataType)(Y,ue);W(Y,ue,!we,Z)}function M(Y){const{schema:Z,errSchemaPath:ue,opts:we,self:Ae}=Y;Z.$ref&&we.ignoreKeywordsWithRef&&(0,y.schemaHasRulesButRef)(Z,Ae.RULES)&&Ae.logger.warn(`$ref: keywords ignored in schema at path "${ue}"`)}function L(Y){const{schema:Z,opts:ue}=Y;Z.default!==void 0&&ue.useDefaults&&ue.strictSchema&&(0,y.checkStrictMode)(Y,"default is ignored in the schema root")}function B(Y){const Z=Y.schema[Y.opts.schemaId];Z&&(Y.baseId=(0,m.resolveUrl)(Y.opts.uriResolver,Y.baseId,Z))}function q(Y){if(Y.schema.$async&&!Y.schemaEnv.$async)throw new Error("async schema in sync schema")}function F({gen:Y,schemaEnv:Z,schema:ue,errSchemaPath:we,opts:Ae}){const Ie=ue.$comment;if(Ae.$comment===!0)Y.code((0,l._)`${d.default.self}.logger.log(${Ie})`);else if(typeof Ae.$comment=="function"){const $e=(0,l.str)`${we}/$comment`,ct=Y.scopeValue("root",{ref:Z.root});Y.code((0,l._)`${d.default.self}.opts.$comment(${Ie}, ${$e}, ${ct}.schema)`)}}function J(Y){const{gen:Z,schemaEnv:ue,validateName:we,ValidationError:Ae,opts:Ie}=Y;ue.$async?Z.if((0,l._)`${d.default.errors} === 0`,()=>Z.return(d.default.data),()=>Z.throw((0,l._)`new ${Ae}(${d.default.vErrors})`)):(Z.assign((0,l._)`${we}.errors`,d.default.vErrors),Ie.unevaluated&&te(Y),Z.return((0,l._)`${d.default.errors} === 0`))}function te({gen:Y,evaluated:Z,props:ue,items:we}){ue instanceof l.Name&&Y.assign((0,l._)`${Z}.props`,ue),we instanceof l.Name&&Y.assign((0,l._)`${Z}.items`,we)}function W(Y,Z,ue,we){const{gen:Ae,schema:Ie,data:$e,allErrors:ct,opts:ut,self:mt}=Y,{RULES:et}=mt;if(Ie.$ref&&(ut.ignoreKeywordsWithRef||!(0,y.schemaHasRulesButRef)(Ie,et))){Ae.block(()=>X(Y,"$ref",et.all.$ref.definition));return}ut.jtd||ee(Y,Z),Ae.block(()=>{for(const tt of et.rules)vt(tt);vt(et.post)});function vt(tt){(0,n.shouldUseGroup)(Ie,tt)&&(tt.type?(Ae.if((0,r.checkDataType)(tt.type,$e,ut.strictNumbers)),se(Y,tt),Z.length===1&&Z[0]===tt.type&&ue&&(Ae.else(),(0,r.reportTypeError)(Y)),Ae.endIf()):se(Y,tt),ct||Ae.if((0,l._)`${d.default.errors} === ${we||0}`))}}function se(Y,Z){const{gen:ue,schema:we,opts:{useDefaults:Ae}}=Y;Ae&&(0,o.assignDefaults)(Y,Z.type),ue.block(()=>{for(const Ie of Z.rules)(0,n.shouldUseRule)(we,Ie)&&X(Y,Ie.keyword,Ie.definition,Z.type)})}function ee(Y,Z){Y.schemaEnv.meta||!Y.opts.strictTypes||(H(Y,Z),Y.opts.allowUnionTypes||$(Y,Z),O(Y,Y.dataTypes))}function H(Y,Z){if(Z.length){if(!Y.dataTypes.length){Y.dataTypes=Z;return}Z.forEach(ue=>{z(Y.dataTypes,ue)||G(Y,`type "${ue}" not allowed by context "${Y.dataTypes.join(",")}"`)}),I(Y,Z)}}function $(Y,Z){Z.length>1&&!(Z.length===2&&Z.includes("null"))&&G(Y,"use allowUnionTypes to allow union type keyword")}function O(Y,Z){const ue=Y.self.RULES.all;for(const we in ue){const Ae=ue[we];if(typeof Ae=="object"&&(0,n.shouldUseRule)(Y.schema,Ae)){const{type:Ie}=Ae.definition;Ie.length&&!Ie.some($e=>P(Z,$e))&&G(Y,`missing type "${Ie.join(",")}" for keyword "${we}"`)}}}function P(Y,Z){return Y.includes(Z)||Z==="number"&&Y.includes("integer")}function z(Y,Z){return Y.includes(Z)||Z==="integer"&&Y.includes("number")}function I(Y,Z){const ue=[];for(const we of Y.dataTypes)z(Z,we)?ue.push(we):Z.includes("integer")&&we==="number"&&ue.push("integer");Y.dataTypes=ue}function G(Y,Z){const ue=Y.schemaEnv.baseId+Y.errSchemaPath;Z+=` at "${ue}" (strictTypes)`,(0,y.checkStrictMode)(Y,Z,Y.opts.strictTypes)}class ie{constructor(Z,ue,we){if((0,c.validateKeywordUsage)(Z,ue,we),this.gen=Z.gen,this.allErrors=Z.allErrors,this.keyword=we,this.data=Z.data,this.schema=Z.schema[we],this.$data=ue.$data&&Z.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,y.schemaRefOrVal)(Z,this.schema,we,this.$data),this.schemaType=ue.schemaType,this.parentSchema=Z.schema,this.params={},this.it=Z,this.def=ue,this.$data)this.schemaCode=Z.gen.const("vSchema",ae(this.$data,Z));else if(this.schemaCode=this.schemaValue,!(0,c.validSchemaType)(this.schema,ue.schemaType,ue.allowUndefined))throw new Error(`${we} value must be ${JSON.stringify(ue.schemaType)}`);("code"in ue?ue.trackErrors:ue.errors!==!1)&&(this.errsCount=Z.gen.const("_errs",d.default.errors))}result(Z,ue,we){this.failResult((0,l.not)(Z),ue,we)}failResult(Z,ue,we){this.gen.if(Z),we?we():this.error(),ue?(this.gen.else(),ue(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(Z,ue){this.failResult((0,l.not)(Z),void 0,ue)}fail(Z){if(Z===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(Z),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(Z){if(!this.$data)return this.fail(Z);const{schemaCode:ue}=this;this.fail((0,l._)`${ue} !== undefined && (${(0,l.or)(this.invalid$data(),Z)})`)}error(Z,ue,we){if(ue){this.setParams(ue),this._error(Z,we),this.setParams({});return}this._error(Z,we)}_error(Z,ue){(Z?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(Z){this.allErrors||this.gen.if(Z)}setParams(Z,ue){ue?Object.assign(this.params,Z):this.params=Z}block$data(Z,ue,we=l.nil){this.gen.block(()=>{this.check$data(Z,we),ue()})}check$data(Z=l.nil,ue=l.nil){if(!this.$data)return;const{gen:we,schemaCode:Ae,schemaType:Ie,def:$e}=this;we.if((0,l.or)((0,l._)`${Ae} === undefined`,ue)),Z!==l.nil&&we.assign(Z,!0),(Ie.length||$e.validateSchema)&&(we.elseIf(this.invalid$data()),this.$dataError(),Z!==l.nil&&we.assign(Z,!1)),we.else()}invalid$data(){const{gen:Z,schemaCode:ue,schemaType:we,def:Ae,it:Ie}=this;return(0,l.or)($e(),ct());function $e(){if(we.length){if(!(ue instanceof l.Name))throw new Error("ajv implementation error");const ut=Array.isArray(we)?we:[we];return(0,l._)`${(0,r.checkDataTypes)(ut,ue,Ie.opts.strictNumbers,r.DataType.Wrong)}`}return l.nil}function ct(){if(Ae.validateSchema){const ut=Z.scopeValue("validate$data",{ref:Ae.validateSchema});return(0,l._)`!${ut}(${ue})`}return l.nil}}subschema(Z,ue){const we=(0,f.getSubschema)(this.it,Z);(0,f.extendSubschemaData)(we,this.it,Z),(0,f.extendSubschemaMode)(we,Z);const Ae={...this.it,...we,items:void 0,props:void 0};return _(Ae,ue),Ae}mergeEvaluated(Z,ue){const{it:we,gen:Ae}=this;we.opts.unevaluated&&(we.props!==!0&&Z.props!==void 0&&(we.props=y.mergeEvaluated.props(Ae,Z.props,we.props,ue)),we.items!==!0&&Z.items!==void 0&&(we.items=y.mergeEvaluated.items(Ae,Z.items,we.items,ue)))}mergeValidEvaluated(Z,ue){const{it:we,gen:Ae}=this;if(we.opts.unevaluated&&(we.props!==!0||we.items!==!0))return Ae.if(ue,()=>this.mergeEvaluated(Z,l.Name)),!0}}Dn.KeywordCxt=ie;function X(Y,Z,ue,we){const Ae=new ie(Y,ue,Z);"code"in ue?ue.code(Ae,we):Ae.$data&&ue.validate?(0,c.funcKeywordCode)(Ae,ue):"macro"in ue?(0,c.macroKeywordCode)(Ae,ue):(ue.compile||ue.validate)&&(0,c.funcKeywordCode)(Ae,ue)}const V=/^\/(?:[^~]|~0|~1)*$/,ce=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ae(Y,{dataLevel:Z,dataNames:ue,dataPathArr:we}){let Ae,Ie;if(Y==="")return d.default.rootData;if(Y[0]==="/"){if(!V.test(Y))throw new Error(`Invalid JSON-pointer: ${Y}`);Ae=Y,Ie=d.default.rootData}else{const mt=ce.exec(Y);if(!mt)throw new Error(`Invalid JSON-pointer: ${Y}`);const et=+mt[1];if(Ae=mt[2],Ae==="#"){if(et>=Z)throw new Error(ut("property/index",et));return we[Z-et]}if(et>Z)throw new Error(ut("data",et));if(Ie=ue[Z-et],!Ae)return Ie}let $e=Ie;const ct=Ae.split("/");for(const mt of ct)mt&&(Ie=(0,l._)`${Ie}${(0,l.getProperty)((0,y.unescapeJsonPointer)(mt))}`,$e=(0,l._)`${$e} && ${Ie}`);return $e;function ut(mt,et){return`Cannot access ${mt} ${et} levels up, current level is ${Z}`}}return Dn.getData=ae,Dn}var Mu={},cS;function pg(){if(cS)return Mu;cS=1,Object.defineProperty(Mu,"__esModule",{value:!0});class e extends Error{constructor(n){super("validation failed"),this.errors=n,this.ajv=this.validation=!0}}return Mu.default=e,Mu}var Ou={},uS;function jh(){if(uS)return Ou;uS=1,Object.defineProperty(Ou,"__esModule",{value:!0});const e=Eh();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 Ou.default=t,Ou}var ki={},dS;function Ah(){if(dS)return ki;dS=1,Object.defineProperty(ki,"__esModule",{value:!0}),ki.resolveSchema=ki.getCompilingSchema=ki.resolveRef=ki.compileSchema=ki.SchemaEnv=void 0;const e=ft(),t=pg(),n=en(),r=Eh(),o=wt(),c=kh();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={}}}ki.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:j}=this.opts,C=new e.CodeGen(this.scope,{es5:_,lines:k,ownProperties:j});let T;g.$async&&(T=C.scopeValue("Error",{ref:t.default,code:(0,e._)`require("ajv/dist/runtime/validation_error").default`}));const A=C.scopeName("validate");g.validateName=A;const M={gen:C,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:C.scopeValue("schema",this.opts.code.source===!0?{ref:g.schema,code:(0,e.stringify)(g.schema)}:{ref:g.schema}),validateName:A,ValidationError:T,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 L;try{this._compilations.add(g),(0,c.validateFunctionCode)(M),C.optimize(this.opts.code.optimize);const B=C.toString();L=`${C.scopeRefs(n.default.scope)}return ${B}`,this.opts.code.process&&(L=this.opts.code.process(L,g));const F=new Function(`${n.default.self}`,`${n.default.scope}`,L)(this,this.scope.get());if(this.scope.value(A,{ref:F}),F.errors=null,F.schema=g.schema,F.schemaEnv=g,g.$async&&(F.$async=!0),this.opts.code.source===!0&&(F.source={validateName:A,validateCode:B,scopeValues:C._values}),this.opts.unevaluated){const{props:J,items:te}=M;F.evaluated={props:J instanceof e.Name?void 0:J,items:te instanceof e.Name?void 0:te,dynamicProps:J instanceof e.Name,dynamicItems:te instanceof e.Name},F.source&&(F.source.evaluated=(0,e.stringify)(F.evaluated))}return g.validate=F,g}catch(B){throw delete g.validate,delete g.validateName,L&&this.logger.error("Error compiling schema, function code:",L),B}finally{this._compilations.delete(g)}}ki.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 j=S.call(this,g,p);if(j===void 0){const C=(_=g.localRefs)===null||_===void 0?void 0:_[p],{schemaId:T}=this.opts;C&&(j=new f({schema:C,schemaId:T,root:g,baseId:b}))}if(j!==void 0)return g.refs[p]=m.call(this,j)}ki.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}ki.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 j=(0,r.normalizeId)(_),C=this.refs[j]||this.schemas[j];if(typeof C=="string"){const T=w.call(this,g,C);return typeof(T==null?void 0:T.schema)!="object"?void 0:x.call(this,p,T)}if(typeof(C==null?void 0:C.schema)=="object"){if(C.validate||l.call(this,C),j===(0,r.normalizeId)(b)){const{schema:T}=C,{schemaId:A}=this.opts,M=T[A];return M&&(k=(0,r.resolveUrl)(this.opts.uriResolver,k,M)),new f({schema:T,schemaId:A,root:g,baseId:k})}return x.call(this,p,C)}}ki.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 T of g.fragment.slice(1).split("/")){if(typeof p=="boolean")return;const A=p[(0,o.unescapeFragment)(T)];if(A===void 0)return;p=A;const M=typeof p=="object"&&p[this.opts.schemaId];!R.has(T)&&M&&(b=(0,r.resolveUrl)(this.opts.uriResolver,b,M))}let j;if(typeof p!="boolean"&&p.$ref&&!(0,o.schemaHasRulesButRef)(p,this.RULES)){const T=(0,r.resolveUrl)(this.opts.uriResolver,b,p.$ref);j=w.call(this,_,T)}const{schemaId:C}=this.opts;if(j=j||new f({schema:p,schemaId:C,root:_,baseId:b}),j.schema!==j.root.schema)return j}return ki}const V5="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",W5="Meta-schema for $data reference (JSON AnySchema extension proposal)",G5="object",K5=["$data"],Y5={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},X5=!1,J5={$id:V5,description:W5,type:G5,required:K5,properties:Y5,additionalProperties:X5};var Du={},Al={exports:{}},Am,hS;function n2(){if(hS)return Am;hS=1;const e=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),t=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),n=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),r=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function c(j){let C="",T=0,A=0;for(A=0;A<j.length;A++)if(T=j[A].charCodeAt(0),T!==48){if(!(T>=48&&T<=57||T>=65&&T<=70||T>=97&&T<=102))return"";C+=j[A];break}for(A+=1;A<j.length;A++){if(T=j[A].charCodeAt(0),!(T>=48&&T<=57||T>=65&&T<=70||T>=97&&T<=102))return"";C+=j[A]}return C}const f=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function l(j){return j.length=0,!0}function d(j,C,T){if(j.length){const A=c(j);if(A!=="")C.push(A);else return T.error=!0,!1;j.length=0}return!0}function m(j){let C=0;const T={error:!1,address:"",zone:""},A=[],M=[];let L=!1,B=!1,q=d;for(let F=0;F<j.length;F++){const J=j[F];if(!(J==="["||J==="]"))if(J===":"){if(L===!0&&(B=!0),!q(M,A,T))break;if(++C>7){T.error=!0;break}F>0&&j[F-1]===":"&&(L=!0),A.push(":");continue}else if(J==="%"){if(!q(M,A,T))break;q=l}else{M.push(J);continue}}return M.length&&(q===l?T.zone=M.join(""):B?A.push(M.join("")):A.push(c(M))),T.address=A.join(""),T}function y(j){if(v(j,":")<2)return{host:j,isIPV6:!1};const C=m(j);if(C.error)return{host:j,isIPV6:!1};{let T=C.address,A=C.address;return C.zone&&(T+="%"+C.zone,A+="%25"+C.zone),{host:T,isIPV6:!0,escapedHost:A}}}function v(j,C){let T=0;for(let A=0;A<j.length;A++)j[A]===C&&T++;return T}function S(j){let C=j;const T=[];let A=-1,M=0;for(;M=C.length;){if(M===1){if(C===".")break;if(C==="/"){T.push("/");break}else{T.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]==="/")){T.push("/");break}}else if(M===3&&C==="/.."){T.length!==0&&T.pop(),T.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),T.length!==0&&T.pop();continue}}if((A=C.indexOf("/",1))===-1){T.push(C);break}else T.push(C.slice(0,A)),C=C.slice(A)}return T.join("")}const w={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},R=/[@/?#:]/g,x=/[@/?#]/g;function g(j,C){const T=C?x:R;return T.lastIndex=0,j.replace(T,A=>w[A])}function b(j,C=!1){if(j.indexOf("%")===-1)return j;let T="";for(let A=0;A<j.length;A++){if(j[A]==="%"&&A+2<j.length){const M=j.slice(A+1,A+3);if(n(M)){const L=M.toUpperCase(),B=String.fromCharCode(parseInt(L,16));C&&r(B)?T+=B:T+="%"+L,A+=2;continue}}T+=j[A]}return T}function p(j){let C="";for(let T=0;T<j.length;T++){if(j[T]==="%"&&T+2<j.length){const A=j.slice(T+1,T+3);if(n(A)){const M=A.toUpperCase(),L=String.fromCharCode(parseInt(M,16));L!=="."&&r(L)?C+=L:C+="%"+M,T+=2;continue}}o(j[T])?C+=j[T]:C+=escape(j[T])}return C}function _(j){let C="";for(let T=0;T<j.length;T++){if(j[T]==="%"&&T+2<j.length){const A=j.slice(T+1,T+3);if(n(A)){C+="%"+A.toUpperCase(),T+=2;continue}}C+=escape(j[T])}return C}function k(j){const C=[];if(j.userinfo!==void 0&&(C.push(j.userinfo),C.push("@")),j.host!==void 0){let T=unescape(j.host);if(!t(T)){const A=y(T);A.isIPV6===!0?T=`[${A.escapedHost}]`:T=g(T,!1)}C.push(T)}return(typeof j.port=="number"||typeof j.port=="string")&&(C.push(":"),C.push(String(j.port))),C.length?C.join(""):void 0}return Am={nonSimpleDomain:f,recomposeAuthority:k,reescapeHostDelimiters:g,normalizePercentEncoding:b,normalizePathEncoding:p,escapePreservingEscapes:_,removeDotSegments:S,isIPv4:t,isUUID:e,normalizeIPv6:y,stringArrayToHexStripped:c},Am}var Rm,fS;function Z5(){if(fS)return Rm;fS=1;const{isUUID:e}=n2(),t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function r(j){return n.indexOf(j)!==-1}function o(j){return j.secure===!0?!0:j.secure===!1?!1:j.scheme?j.scheme.length===3&&(j.scheme[0]==="w"||j.scheme[0]==="W")&&(j.scheme[1]==="s"||j.scheme[1]==="S")&&(j.scheme[2]==="s"||j.scheme[2]==="S"):!1}function c(j){return j.host||(j.error=j.error||"HTTP URIs must have a host."),j}function f(j){const C=String(j.scheme).toLowerCase()==="https";return(j.port===(C?443:80)||j.port==="")&&(j.port=void 0),j.path||(j.path="/"),j}function l(j){return j.secure=o(j),j.resourceName=(j.path||"/")+(j.query?"?"+j.query:""),j.path=void 0,j.query=void 0,j}function d(j){if((j.port===(o(j)?443:80)||j.port==="")&&(j.port=void 0),typeof j.secure=="boolean"&&(j.scheme=j.secure?"wss":"ws",j.secure=void 0),j.resourceName){const[C,T]=j.resourceName.split("?");j.path=C&&C!=="/"?C:void 0,j.query=T,j.resourceName=void 0}return j.fragment=void 0,j}function m(j,C){if(!j.path)return j.error="URN can not be parsed",j;const T=j.path.match(t);if(T){const A=C.scheme||j.scheme||"urn";j.nid=T[1].toLowerCase(),j.nss=T[2];const M=`${A}:${C.nid||j.nid}`,L=k(M);j.path=void 0,L&&(j=L.parse(j,C))}else j.error=j.error||"URN can not be parsed.";return j}function y(j,C){if(j.nid===void 0)throw new Error("URN without nid cannot be serialized");const T=C.scheme||j.scheme||"urn",A=j.nid.toLowerCase(),M=`${T}:${C.nid||A}`,L=k(M);L&&(j=L.serialize(j,C));const B=j,q=j.nss;return B.path=`${A||C.nid}:${q}`,C.skipEscape=!0,B}function v(j,C){const T=j;return T.uuid=T.nss,T.nss=void 0,!C.tolerant&&(!T.uuid||!e(T.uuid))&&(T.error=T.error||"UUID is not valid."),T}function S(j){const C=j;return C.nss=(j.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(j){return j&&(_[j]||_[j.toLowerCase()])||void 0}return Rm={wsIsSecure:o,SCHEMES:_,isValidSchemeName:r,getSchemeHandler:k},Rm}var pS;function Q5(){if(pS)return Al.exports;pS=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:n,normalizePercentEncoding:r,normalizePathEncoding:o,escapePreservingEscapes:c,reescapeHostDelimiters:f,isIPv4:l,nonSimpleDomain:d}=n2(),{SCHEMES:m,getSchemeHandler:y}=Z5();function v(A,M){return typeof A=="string"?A=k(A,M):typeof A=="object"&&(A=_(x(A,M),M)),A}function S(A,M,L){const B=L?Object.assign({scheme:"null"},L):{scheme:"null"},q=w(_(A,B),_(M,B),B,!0);return B.skipEscape=!0,x(q,B)}function w(A,M,L,B){const q={};return B||(A=_(x(A,L),L),M=_(x(M,L),L)),L=L||{},!L.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):((A.userinfo!==void 0||A.host!==void 0||A.port!==void 0)&&!A.path?q.path="/"+M.path:A.path?q.path=A.path.slice(0,A.path.lastIndexOf("/")+1)+M.path:q.path=M.path,q.path=t(q.path)),q.query=M.query):(q.path=A.path,M.query!==void 0?q.query=M.query:q.query=A.query),q.userinfo=A.userinfo,q.host=A.host,q.port=A.port),q.scheme=A.scheme),q.fragment=M.fragment,q}function R(A,M,L){const B=C(A,L),q=C(M,L);return B!==void 0&&q!==void 0&&B.toLowerCase()===q.toLowerCase()}function x(A,M){const L={host:A.host,scheme:A.scheme,userinfo:A.userinfo,port:A.port,path:A.path,query:A.query,nid:A.nid,nss:A.nss,uuid:A.uuid,fragment:A.fragment,reference:A.reference,resourceName:A.resourceName,secure:A.secure,error:""},B=Object.assign({},M),q=[],F=y(B.scheme||L.scheme);F&&F.serialize&&F.serialize(L,B),L.path!==void 0&&(B.skipEscape?L.path=r(L.path):(L.path=c(L.path),L.scheme!==void 0&&(L.path=L.path.split("%3A").join(":")))),B.reference!=="suffix"&&L.scheme&&q.push(L.scheme,":");const J=n(L);if(J!==void 0&&(B.reference!=="suffix"&&q.push("//"),q.push(J),L.path&&L.path[0]!=="/"&&q.push("/")),L.path!==void 0){let te=L.path;!B.absolutePath&&(!F||!F.absolutePath)&&(te=t(te)),J===void 0&&te[0]==="/"&&te[1]==="/"&&(te="/%2F"+te.slice(2)),q.push(te)}return L.query!==void 0&&q.push("?",L.query),L.fragment!==void 0&&q.push("#",L.fragment),q.join("")}const g=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function b(A,M){if(M[2]!==void 0&&A.path&&A.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof A.port=="number"&&(A.port<0||A.port>65535))return"URI port is malformed."}function p(A,M){const L=Object.assign({},M),B={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let q=!1,F=!1;L.reference==="suffix"&&(L.scheme?A=L.scheme+":"+A:A="//"+A);const J=A.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 te=b(B,J);if(te!==void 0&&(B.error=B.error||te,q=!0),B.host)if(l(B.host)===!1){const ee=e(B.host);B.host=ee.host.toLowerCase(),F=ee.isIPV6}else F=!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",L.reference&&L.reference!=="suffix"&&L.reference!==B.reference&&(B.error=B.error||"URI is not a "+L.reference+" reference.");const W=y(L.scheme||B.scheme);if(!L.unicodeSupport&&(!W||!W.unicodeSupport)&&B.host&&(L.domainHost||W&&W.domainHost)&&F===!1&&d(B.host))try{B.host=URL.domainToASCII(B.host.toLowerCase())}catch(se){B.error=B.error||"Host's domain name can not be converted to ASCII: "+se}if((!W||W&&!W.skipNormalize)&&(A.indexOf("%")!==-1&&(B.scheme!==void 0&&(B.scheme=unescape(B.scheme)),B.host!==void 0&&(B.host=f(unescape(B.host),F))),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,L)}else B.error=B.error||"URI can not be parsed.";return{parsed:B,malformedAuthorityOrPort:q}}function _(A,M){return p(A,M).parsed}function k(A,M){return j(A,M).normalized}function j(A,M){const{parsed:L,malformedAuthorityOrPort:B}=p(A,M);return{normalized:B?A:x(L,M),malformedAuthorityOrPort:B}}function C(A,M){if(typeof A=="string"){const{normalized:L,malformedAuthorityOrPort:B}=j(A,M);return B?void 0:L}if(typeof A=="object")return x(A,M)}const T={SCHEMES:m,normalize:v,resolve:S,resolveComponent:w,equal:R,serialize:x,parse:_};return Al.exports=T,Al.exports.default=T,Al.exports.fastUri=T,Al.exports}var mS;function eM(){if(mS)return Du;mS=1,Object.defineProperty(Du,"__esModule",{value:!0});const e=Q5();return e.code='require("ajv/dist/runtime/uri").default',Du.default=e,Du}var vS;function tM(){return vS||(vS=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=kh();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=ft();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});const r=pg(),o=jh(),c=t2(),f=Ah(),l=ft(),d=Eh(),m=ph(),y=wt(),v=J5,S=eM(),w=($,O)=>new RegExp($,O);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 _($){var O,P,z,I,G,ie,X,V,ce,ae,Y,Z,ue,we,Ae,Ie,$e,ct,ut,mt,et,vt,tt,Ke,Ot;const jt=$.strict,fs=(O=$.code)===null||O===void 0?void 0:O.optimize,Dt=fs===!0||fs===void 0?1:fs||0,xt=(z=(P=$.code)===null||P===void 0?void 0:P.regExp)!==null&&z!==void 0?z:w,gs=(I=$.uriResolver)!==null&&I!==void 0?I:S.default;return{strictSchema:(ie=(G=$.strictSchema)!==null&&G!==void 0?G:jt)!==null&&ie!==void 0?ie:!0,strictNumbers:(V=(X=$.strictNumbers)!==null&&X!==void 0?X:jt)!==null&&V!==void 0?V:!0,strictTypes:(ae=(ce=$.strictTypes)!==null&&ce!==void 0?ce:jt)!==null&&ae!==void 0?ae:"log",strictTuples:(Z=(Y=$.strictTuples)!==null&&Y!==void 0?Y:jt)!==null&&Z!==void 0?Z:"log",strictRequired:(we=(ue=$.strictRequired)!==null&&ue!==void 0?ue:jt)!==null&&we!==void 0?we:!1,code:$.code?{...$.code,optimize:Dt,regExp:xt}:{optimize:Dt,regExp:xt},loopRequired:(Ae=$.loopRequired)!==null&&Ae!==void 0?Ae:p,loopEnum:(Ie=$.loopEnum)!==null&&Ie!==void 0?Ie:p,meta:($e=$.meta)!==null&&$e!==void 0?$e:!0,messages:(ct=$.messages)!==null&&ct!==void 0?ct:!0,inlineRefs:(ut=$.inlineRefs)!==null&&ut!==void 0?ut:!0,schemaId:(mt=$.schemaId)!==null&&mt!==void 0?mt:"$id",addUsedSchema:(et=$.addUsedSchema)!==null&&et!==void 0?et:!0,validateSchema:(vt=$.validateSchema)!==null&&vt!==void 0?vt:!0,validateFormats:(tt=$.validateFormats)!==null&&tt!==void 0?tt:!0,unicodeRegExp:(Ke=$.unicodeRegExp)!==null&&Ke!==void 0?Ke:!0,int32range:(Ot=$.int32range)!==null&&Ot!==void 0?Ot:!0,uriResolver:gs}}class k{constructor(O={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,O=this.opts={...O,..._(O)};const{es5:P,lines:z}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:x,es5:P,lines:z}),this.logger=q(O.logger);const I=O.validateFormats;O.validateFormats=!1,this.RULES=(0,c.getRules)(),j.call(this,g,O,"NOT SUPPORTED"),j.call(this,b,O,"DEPRECATED","warn"),this._metaOpts=L.call(this),O.formats&&A.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),O.keywords&&M.call(this,O.keywords),typeof O.meta=="object"&&this.addMetaSchema(O.meta),T.call(this),O.validateFormats=I}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:O,meta:P,schemaId:z}=this.opts;let I=v;z==="id"&&(I={...v},I.id=I.$id,delete I.$id),P&&O&&this.addMetaSchema(I,I[z],!1)}defaultMeta(){const{meta:O,schemaId:P}=this.opts;return this.opts.defaultMeta=typeof O=="object"?O[P]||O:void 0}validate(O,P){let z;if(typeof O=="string"){if(z=this.getSchema(O),!z)throw new Error(`no schema with key or ref "${O}"`)}else z=this.compile(O);const I=z(P);return"$async"in z||(this.errors=z.errors),I}compile(O,P){const z=this._addSchema(O,P);return z.validate||this._compileSchemaEnv(z)}compileAsync(O,P){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:z}=this.opts;return I.call(this,O,P);async function I(ae,Y){await G.call(this,ae.$schema);const Z=this._addSchema(ae,Y);return Z.validate||ie.call(this,Z)}async function G(ae){ae&&!this.getSchema(ae)&&await I.call(this,{$ref:ae},!0)}async function ie(ae){try{return this._compileSchemaEnv(ae)}catch(Y){if(!(Y instanceof o.default))throw Y;return X.call(this,Y),await V.call(this,Y.missingSchema),ie.call(this,ae)}}function X({missingSchema:ae,missingRef:Y}){if(this.refs[ae])throw new Error(`AnySchema ${ae} is loaded but ${Y} cannot be resolved`)}async function V(ae){const Y=await ce.call(this,ae);this.refs[ae]||await G.call(this,Y.$schema),this.refs[ae]||this.addSchema(Y,ae,P)}async function ce(ae){const Y=this._loading[ae];if(Y)return Y;try{return await(this._loading[ae]=z(ae))}finally{delete this._loading[ae]}}}addSchema(O,P,z,I=this.opts.validateSchema){if(Array.isArray(O)){for(const ie of O)this.addSchema(ie,void 0,z,I);return this}let G;if(typeof O=="object"){const{schemaId:ie}=this.opts;if(G=O[ie],G!==void 0&&typeof G!="string")throw new Error(`schema ${ie} must be string`)}return P=(0,d.normalizeId)(P||G),this._checkUnique(P),this.schemas[P]=this._addSchema(O,z,P,I,!0),this}addMetaSchema(O,P,z=this.opts.validateSchema){return this.addSchema(O,P,!0,z),this}validateSchema(O,P){if(typeof O=="boolean")return!0;let z;if(z=O.$schema,z!==void 0&&typeof z!="string")throw new Error("$schema must be a string");if(z=z||this.opts.defaultMeta||this.defaultMeta(),!z)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const I=this.validate(z,O);if(!I&&P){const G="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(G);else throw new Error(G)}return I}getSchema(O){let P;for(;typeof(P=C.call(this,O))=="string";)O=P;if(P===void 0){const{schemaId:z}=this.opts,I=new f.SchemaEnv({schema:{},schemaId:z});if(P=f.resolveSchema.call(this,I,O),!P)return;this.refs[O]=P}return P.validate||this._compileSchemaEnv(P)}removeSchema(O){if(O instanceof RegExp)return this._removeAllSchemas(this.schemas,O),this._removeAllSchemas(this.refs,O),this;switch(typeof O){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const P=C.call(this,O);return typeof P=="object"&&this._cache.delete(P.schema),delete this.schemas[O],delete this.refs[O],this}case"object":{const P=O;this._cache.delete(P);let z=O[this.opts.schemaId];return z&&(z=(0,d.normalizeId)(z),delete this.schemas[z],delete this.refs[z]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(O){for(const P of O)this.addKeyword(P);return this}addKeyword(O,P){let z;if(typeof O=="string")z=O,typeof P=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),P.keyword=z);else if(typeof O=="object"&&P===void 0){if(P=O,z=P.keyword,Array.isArray(z)&&!z.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(J.call(this,z,P),!P)return(0,y.eachItem)(z,G=>te.call(this,G)),this;se.call(this,P);const I={...P,type:(0,m.getJSONTypes)(P.type),schemaType:(0,m.getJSONTypes)(P.schemaType)};return(0,y.eachItem)(z,I.type.length===0?G=>te.call(this,G,I):G=>I.type.forEach(ie=>te.call(this,G,I,ie))),this}getKeyword(O){const P=this.RULES.all[O];return typeof P=="object"?P.definition:!!P}removeKeyword(O){const{RULES:P}=this;delete P.keywords[O],delete P.all[O];for(const z of P.rules){const I=z.rules.findIndex(G=>G.keyword===O);I>=0&&z.rules.splice(I,1)}return this}addFormat(O,P){return typeof P=="string"&&(P=new RegExp(P)),this.formats[O]=P,this}errorsText(O=this.errors,{separator:P=", ",dataVar:z="data"}={}){return!O||O.length===0?"No errors":O.map(I=>`${z}${I.instancePath} ${I.message}`).reduce((I,G)=>I+P+G)}$dataMetaSchema(O,P){const z=this.RULES.all;O=JSON.parse(JSON.stringify(O));for(const I of P){const G=I.split("/").slice(1);let ie=O;for(const X of G)ie=ie[X];for(const X in z){const V=z[X];if(typeof V!="object")continue;const{$data:ce}=V.definition,ae=ie[X];ce&&ae&&(ie[X]=H(ae))}}return O}_removeAllSchemas(O,P){for(const z in O){const I=O[z];(!P||P.test(z))&&(typeof I=="string"?delete O[z]:I&&!I.meta&&(this._cache.delete(I.schema),delete O[z]))}}_addSchema(O,P,z,I=this.opts.validateSchema,G=this.opts.addUsedSchema){let ie;const{schemaId:X}=this.opts;if(typeof O=="object")ie=O[X];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof O!="boolean")throw new Error("schema must be object or boolean")}let V=this._cache.get(O);if(V!==void 0)return V;z=(0,d.normalizeId)(ie||z);const ce=d.getSchemaRefs.call(this,O,z);return V=new f.SchemaEnv({schema:O,schemaId:X,meta:P,baseId:z,localRefs:ce}),this._cache.set(V.schema,V),G&&!z.startsWith("#")&&(z&&this._checkUnique(z),this.refs[z]=V),I&&this.validateSchema(O,!0),V}_checkUnique(O){if(this.schemas[O]||this.refs[O])throw new Error(`schema with key or id "${O}" already exists`)}_compileSchemaEnv(O){if(O.meta?this._compileMetaSchema(O):f.compileSchema.call(this,O),!O.validate)throw new Error("ajv implementation error");return O.validate}_compileMetaSchema(O){const P=this.opts;this.opts=this._metaOpts;try{f.compileSchema.call(this,O)}finally{this.opts=P}}}k.ValidationError=r.default,k.MissingRefError=o.default,e.default=k;function j($,O,P,z="error"){for(const I in $){const G=I;G in O&&this.logger[z](`${P}: option ${I}. ${$[G]}`)}}function C($){return $=(0,d.normalizeId)($),this.schemas[$]||this.refs[$]}function T(){const $=this.opts.schemas;if($)if(Array.isArray($))this.addSchema($);else for(const O in $)this.addSchema($[O],O)}function A(){for(const $ in this.opts.formats){const O=this.opts.formats[$];O&&this.addFormat($,O)}}function M($){if(Array.isArray($)){this.addVocabulary($);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const O in $){const P=$[O];P.keyword||(P.keyword=O),this.addKeyword(P)}}function L(){const $={...this.opts};for(const O of R)delete $[O];return $}const B={log(){},warn(){},error(){}};function q($){if($===!1)return B;if($===void 0)return console;if($.log&&$.warn&&$.error)return $;throw new Error("logger must implement log, warn and error methods")}const F=/^[a-z_$][a-z0-9_$:-]*$/i;function J($,O){const{RULES:P}=this;if((0,y.eachItem)($,z=>{if(P.keywords[z])throw new Error(`Keyword ${z} is already defined`);if(!F.test(z))throw new Error(`Keyword ${z} has invalid name`)}),!!O&&O.$data&&!("code"in O||"validate"in O))throw new Error('$data keyword must have "code" or "validate" function')}function te($,O,P){var z;const I=O==null?void 0:O.post;if(P&&I)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:G}=this;let ie=I?G.post:G.rules.find(({type:V})=>V===P);if(ie||(ie={type:P,rules:[]},G.rules.push(ie)),G.keywords[$]=!0,!O)return;const X={keyword:$,definition:{...O,type:(0,m.getJSONTypes)(O.type),schemaType:(0,m.getJSONTypes)(O.schemaType)}};O.before?W.call(this,ie,X,O.before):ie.rules.push(X),G.all[$]=X,(z=O.implements)===null||z===void 0||z.forEach(V=>this.addKeyword(V))}function W($,O,P){const z=$.rules.findIndex(I=>I.keyword===P);z>=0?$.rules.splice(z,0,O):($.rules.push(O),this.logger.warn(`rule ${P} is not defined`))}function se($){let{metaSchema:O}=$;O!==void 0&&($.$data&&this.opts.$data&&(O=H(O)),$.validateSchema=this.compile(O,!0))}const ee={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function H($){return{anyOf:[$,ee]}}})(Sm)),Sm}var $u={},Lu={},Iu={},gS;function sM(){if(gS)return Iu;gS=1,Object.defineProperty(Iu,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return Iu.default=e,Iu}var gr={},_S;function mg(){if(_S)return gr;_S=1,Object.defineProperty(gr,"__esModule",{value:!0}),gr.callRef=gr.getValidate=void 0;const e=jh(),t=tn(),n=ft(),r=en(),o=Ah(),c=wt(),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 j(_);return C(_);function k(){if(R===p)return d(m,x,R,R.$async);const T=y.scopeValue("root",{ref:p});return d(m,(0,n._)`${T}.validate`,p,p.$async)}function j(T){const A=l(m,T);d(m,A,T,T.$async)}function C(T){const A=y.scopeValue("schema",g.code.source===!0?{ref:T,code:(0,n.stringify)(T)}:{ref:T}),M=y.name("valid"),L=m.subschema({schema:T,dataTypes:[],schemaPath:n.nil,topSchemaRef:A,errSchemaPath:v},M);m.mergeEvaluated(L),m.ok(M)}}};function l(m,y){const{gen:v}=m;return y.validate?v.scopeValue("validate",{ref:y.validate}):(0,n._)`${v.scopeValue("wrapper",{ref:y})}.validate`}gr.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:n.nil;S?_():k();function _(){if(!g.$async)throw new Error("async schema referenced by sync schema");const T=w.let("valid");w.try(()=>{w.code((0,n._)`await ${(0,t.callValidateCode)(m,y,p)}`),C(y),x||w.assign(T,!0)},A=>{w.if((0,n._)`!(${A} instanceof ${R.ValidationError})`,()=>w.throw(A)),j(A),x||w.assign(T,!1)}),m.ok(T)}function k(){m.result((0,t.callValidateCode)(m,y,p),()=>C(y),()=>j(y))}function j(T){const A=(0,n._)`${T}.errors`;w.assign(r.default.vErrors,(0,n._)`${r.default.vErrors} === null ? ${A} : ${r.default.vErrors}.concat(${A})`),w.assign(r.default.errors,(0,n._)`${r.default.vErrors}.length`)}function C(T){var A;if(!R.opts.unevaluated)return;const M=(A=v==null?void 0:v.validate)===null||A===void 0?void 0:A.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 L=w.var("props",(0,n._)`${T}.evaluated.props`);R.props=c.mergeEvaluated.props(w,L,R.props,n.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 L=w.var("items",(0,n._)`${T}.evaluated.items`);R.items=c.mergeEvaluated.items(w,L,R.items,n.Name)}}}return gr.callRef=d,gr.default=f,gr}var yS;function iM(){if(yS)return Lu;yS=1,Object.defineProperty(Lu,"__esModule",{value:!0});const e=sM(),t=mg(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return Lu.default=n,Lu}var Pu={},Bu={},bS;function nM(){if(bS)return Bu;bS=1,Object.defineProperty(Bu,"__esModule",{value:!0});const e=ft(),t=e.operators,n={maximum:{okStr:"<=",ok:t.LTE,fail:t.GT},minimum:{okStr:">=",ok:t.GTE,fail:t.LT},exclusiveMaximum:{okStr:"<",ok:t.LT,fail:t.GTE},exclusiveMinimum:{okStr:">",ok:t.GT,fail:t.LTE}},r={message:({keyword:c,schemaCode:f})=>(0,e.str)`must be ${n[c].okStr} ${f}`,params:({keyword:c,schemaCode:f})=>(0,e._)`{comparison: ${n[c].okStr}, limit: ${f}}`},o={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:r,code(c){const{keyword:f,data:l,schemaCode:d}=c;c.fail$data((0,e._)`${l} ${n[f].fail} ${d} || isNaN(${l})`)}};return Bu.default=o,Bu}var Hu={},SS;function rM(){if(SS)return Hu;SS=1,Object.defineProperty(Hu,"__esModule",{value:!0});const e=ft(),n={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:r})=>(0,e.str)`must be multiple of ${r}`,params:({schemaCode:r})=>(0,e._)`{multipleOf: ${r}}`},code(r){const{gen:o,data:c,schemaCode: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 Hu.default=n,Hu}var zu={},Uu={},wS;function aM(){if(wS)return Uu;wS=1,Object.defineProperty(Uu,"__esModule",{value:!0});function e(t){const n=t.length;let r=0,o=0,c;for(;o<n;)r++,c=t.charCodeAt(o++),c>=55296&&c<=56319&&o<n&&(c=t.charCodeAt(o),(c&64512)===56320&&o++);return r}return Uu.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',Uu}var xS;function oM(){if(xS)return zu;xS=1,Object.defineProperty(zu,"__esModule",{value:!0});const e=ft(),t=wt(),n=aM(),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,n.default)}(${l})`;c.fail$data((0,e._)`${v} ${y} ${d}`)}};return zu.default=o,zu}var qu={},CS;function lM(){if(CS)return qu;CS=1,Object.defineProperty(qu,"__esModule",{value:!0});const e=tn(),t=wt(),n=ft(),o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:c})=>(0,n.str)`must match pattern "${c}"`,params:({schemaCode:c})=>(0,n._)`{pattern: ${c}}`},code(c){const{gen: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,n._)`new RegExp`:(0,t.useFunc)(f,w),x=f.let("valid");f.try(()=>f.assign(x,(0,n._)`${R}(${y}, ${S}).test(${l})`),()=>f.assign(x,!1)),c.fail$data((0,n._)`!${x}`)}else{const w=(0,e.usePattern)(c,m);c.fail$data((0,n._)`!${w}.test(${l})`)}}};return qu.default=o,qu}var Fu={},ES;function cM(){if(ES)return Fu;ES=1,Object.defineProperty(Fu,"__esModule",{value:!0});const e=ft(),n={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:r,schemaCode:o}){const c=r==="maxProperties"?"more":"fewer";return(0,e.str)`must NOT have ${c} than ${o} properties`},params:({schemaCode:r})=>(0,e._)`{limit: ${r}}`},code(r){const{keyword:o,data:c,schemaCode:f}=r,l=o==="maxProperties"?e.operators.GT:e.operators.LT;r.fail$data((0,e._)`Object.keys(${c}).length ${l} ${f}`)}};return Fu.default=n,Fu}var Vu={},kS;function uM(){if(kS)return Vu;kS=1,Object.defineProperty(Vu,"__esModule",{value:!0});const e=tn(),t=ft(),n=wt(),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 j=v.schemaEnv.baseId+v.errSchemaPath,C=`required property "${k}" is not defined at "${j}" (strictRequired)`;(0,n.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 Vu.default=o,Vu}var Wu={},jS;function dM(){if(jS)return Wu;jS=1,Object.defineProperty(Wu,"__esModule",{value:!0});const e=ft(),n={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:r,schemaCode:o}){const c=r==="maxItems"?"more":"fewer";return(0,e.str)`must NOT have ${c} than ${o} items`},params:({schemaCode:r})=>(0,e._)`{limit: ${r}}`},code(r){const{keyword:o,data:c,schemaCode:f}=r,l=o==="maxItems"?e.operators.GT:e.operators.LT;r.fail$data((0,e._)`${c}.length ${l} ${f}`)}};return Wu.default=n,Wu}var Gu={},Ku={},AS;function vg(){if(AS)return Ku;AS=1,Object.defineProperty(Ku,"__esModule",{value:!0});const e=i2();return e.code='require("ajv/dist/runtime/equal").default',Ku.default=e,Ku}var RS;function hM(){if(RS)return Gu;RS=1,Object.defineProperty(Gu,"__esModule",{value:!0});const e=ph(),t=ft(),n=wt(),r=vg(),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`),j=l.let("j");f.setParams({i:k,j}),l.assign(R,!0),l.if((0,t._)`${k} > 1`,()=>(b()?p:_)(k,j))}function b(){return x.length>0&&!x.some(k=>k==="object"||k==="array")}function p(k,j){const C=l.name("item"),T=(0,e.checkDataTypes)(x,C,w.opts.strictNumbers,e.DataType.Wrong),A=l.const("indices",(0,t._)`{}`);l.for((0,t._)`;${k}--;`,()=>{l.let(C,(0,t._)`${d}[${k}]`),l.if(T,(0,t._)`continue`),x.length>1&&l.if((0,t._)`typeof ${C} == "string"`,(0,t._)`${C} += "_"`),l.if((0,t._)`typeof ${A}[${C}] == "number"`,()=>{l.assign(j,(0,t._)`${A}[${C}]`),f.error(),l.assign(R,!1).break()}).code((0,t._)`${A}[${C}] = ${k}`)})}function _(k,j){const C=(0,n.useFunc)(l,r.default),T=l.name("outer");l.label(T).for((0,t._)`;${k}--;`,()=>l.for((0,t._)`${j} = ${k}; ${j}--;`,()=>l.if((0,t._)`${C}(${d}[${k}], ${d}[${j}])`,()=>{f.error(),l.assign(R,!1).break(T)})))}}};return Gu.default=c,Gu}var Yu={},TS;function fM(){if(TS)return Yu;TS=1,Object.defineProperty(Yu,"__esModule",{value:!0});const e=ft(),t=wt(),n=vg(),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,n.default)}(${l}, ${m})`):c.fail((0,e._)`${y} !== ${l}`)}};return Yu.default=o,Yu}var Xu={},NS;function pM(){if(NS)return Xu;NS=1,Object.defineProperty(Xu,"__esModule",{value:!0});const e=ft(),t=wt(),n=vg(),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,n.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 Xu.default=o,Xu}var MS;function mM(){if(MS)return Pu;MS=1,Object.defineProperty(Pu,"__esModule",{value:!0});const e=nM(),t=rM(),n=oM(),r=lM(),o=cM(),c=uM(),f=dM(),l=hM(),d=fM(),m=pM(),y=[e.default,t.default,n.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 Pu.default=y,Pu}var Ju={},Ya={},OS;function r2(){if(OS)return Ya;OS=1,Object.defineProperty(Ya,"__esModule",{value:!0}),Ya.validateAdditionalItems=void 0;const e=ft(),t=wt(),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 Ya.validateAdditionalItems=o,Ya.default=r,Ya}var Zu={},Xa={},DS;function a2(){if(DS)return Xa;DS=1,Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.validateTuple=void 0;const e=ft(),t=wt(),n=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,n.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 j=`"${v}" is ${_}-tuple, but minItems or maxItems/${f} are not specified or different at path "${p}"`;(0,t.checkStrictMode)(S,j,b.strictTuples)}}}return Xa.validateTuple=o,Xa.default=r,Xa}var $S;function vM(){if($S)return Zu;$S=1,Object.defineProperty(Zu,"__esModule",{value:!0});const e=a2(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:n=>(0,e.validateTuple)(n,"items")};return Zu.default=t,Zu}var Qu={},LS;function gM(){if(LS)return Qu;LS=1,Object.defineProperty(Qu,"__esModule",{value:!0});const e=ft(),t=wt(),n=tn(),r=r2(),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,n.validateArray)(f)))}};return Qu.default=c,Qu}var ed={},IS;function _M(){if(IS)return ed;IS=1,Object.defineProperty(ed,"__esModule",{value:!0});const e=ft(),t=wt(),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,j=>{o.subschema({keyword:"contains",dataProp:j,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 ed.default=r,ed}var Tm={},PS;function gg(){return PS||(PS=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=ft(),n=wt(),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,n.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})(Tm)),Tm}var td={},BS;function yM(){if(BS)return td;BS=1,Object.defineProperty(td,"__esModule",{value:!0});const e=ft(),t=wt(),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 td.default=r,td}var sd={},HS;function o2(){if(HS)return sd;HS=1,Object.defineProperty(sd,"__esModule",{value:!0});const e=tn(),t=ft(),n=en(),r=wt(),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} === ${n.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 T;if(x.length>8){const A=(0,r.schemaRefOrVal)(S,m.properties,"properties");T=(0,e.isOwnProperty)(l,A,C)}else x.length?T=(0,t.or)(...x.map(A=>(0,t._)`${C} === ${A}`)):T=t.nil;return g.length&&(T=(0,t.or)(T,...g.map(A=>(0,t._)`${(0,e.usePattern)(f,A)}.test(${C})`))),(0,t.not)(T)}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 T=l.name("valid");R.removeAdditional==="failing"?(j(C,T,!1),l.if((0,t.not)(T),()=>{f.reset(),_(C)})):(j(C,T),w||l.if((0,t.not)(T),()=>l.break()))}}function j(C,T,A){const M={keyword:"additionalProperties",dataProp:C,dataPropType:r.Type.Str};A===!1&&Object.assign(M,{compositeRule:!0,createErrors:!1,allErrors:!1}),f.subschema(M,T)}}};return sd.default=c,sd}var id={},zS;function bM(){if(zS)return id;zS=1,Object.defineProperty(id,"__esModule",{value:!0});const e=kh(),t=tn(),n=wt(),r=o2(),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=n.mergeEvaluated.props(f,(0,n.toHash)(v),y.props));const S=v.filter(g=>!(0,n.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 id.default=o,id}var nd={},US;function SM(){if(US)return nd;US=1,Object.defineProperty(nd,"__esModule",{value:!0});const e=tn(),t=ft(),n=wt(),r=wt(),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,n.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 j in R)new RegExp(k).test(j)&&(0,n.checkStrictMode)(y,`property ${j} matches pattern ${k} (use allowMatchingProperties)`)}function _(k){f.forIn("key",d,j=>{f.if((0,t._)`${(0,e.usePattern)(c,k)}.test(${j})`,()=>{const C=w.includes(k);C||c.subschema({keyword:"patternProperties",schemaProp:k,dataProp:j,dataPropType:r.Type.Str},x),y.opts.unevaluated&&g!==!0?f.assign((0,t._)`${g}[${j}]`,!0):!C&&!y.allErrors&&f.if((0,t.not)(x),()=>f.break())})})}}};return nd.default=o,nd}var rd={},qS;function wM(){if(qS)return rd;qS=1,Object.defineProperty(rd,"__esModule",{value:!0});const e=wt(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){const{gen:r,schema:o,it:c}=n;if((0,e.alwaysValidSchema)(c,o)){n.fail();return}const f=r.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},f),n.failResult(f,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};return rd.default=t,rd}var ad={},FS;function xM(){if(FS)return ad;FS=1,Object.defineProperty(ad,"__esModule",{value:!0});const t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:tn().validateUnion,error:{message:"must match a schema in anyOf"}};return ad.default=t,ad}var od={},VS;function CM(){if(VS)return od;VS=1,Object.defineProperty(od,"__esModule",{value:!0});const e=ft(),t=wt(),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 od.default=r,od}var ld={},WS;function EM(){if(WS)return ld;WS=1,Object.defineProperty(ld,"__esModule",{value:!0});const e=wt(),t={keyword:"allOf",schemaType:"array",code(n){const{gen:r,schema:o,it:c}=n;if(!Array.isArray(o))throw new Error("ajv implementation error");const f=r.name("valid");o.forEach((l,d)=>{if((0,e.alwaysValidSchema)(c,l))return;const m=n.subschema({keyword:"allOf",schemaProp:d},f);n.ok(f),n.mergeEvaluated(m)})}};return ld.default=t,ld}var cd={},GS;function kM(){if(GS)return cd;GS=1,Object.defineProperty(cd,"__esModule",{value:!0});const e=ft(),t=wt(),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 cd.default=r,cd}var ud={},KS;function jM(){if(KS)return ud;KS=1,Object.defineProperty(ud,"__esModule",{value:!0});const e=wt(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:r,it:o}){r.if===void 0&&(0,e.checkStrictMode)(o,`"${n}" without "if" is ignored`)}};return ud.default=t,ud}var YS;function AM(){if(YS)return Ju;YS=1,Object.defineProperty(Ju,"__esModule",{value:!0});const e=r2(),t=vM(),n=a2(),r=gM(),o=_M(),c=gg(),f=yM(),l=o2(),d=bM(),m=SM(),y=wM(),v=xM(),S=CM(),w=EM(),R=kM(),x=jM();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,n.default),p.push(o.default),p}return Ju.default=g,Ju}var dd={},Ja={},XS;function l2(){if(XS)return Ja;XS=1,Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.dynamicAnchor=void 0;const e=ft(),t=en(),n=Ah(),r=mg(),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))}Ja.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 n.SchemaEnv({schema:m,schemaId:x,root:v,baseId:S,localRefs:w,meta:R});return n.compileSchema.call(y,g),(0,r.getValidate)(l,g)}return Ja.default=o,Ja}var Za={},JS;function c2(){if(JS)return Za;JS=1,Object.defineProperty(Za,"__esModule",{value:!0}),Za.dynamicRef=void 0;const e=ft(),t=en(),n=mg(),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,n.callRef)(c,w),l.let(R,!0)}):()=>(0,n.callRef)(c,w)}}return Za.dynamicRef=o,Za.default=r,Za}var hd={},ZS;function RM(){if(ZS)return hd;ZS=1,Object.defineProperty(hd,"__esModule",{value:!0});const e=l2(),t=wt(),n={keyword:"$recursiveAnchor",schemaType:"boolean",code(r){r.schema?(0,e.dynamicAnchor)(r,""):(0,t.checkStrictMode)(r.it,"$recursiveAnchor: false is ignored")}};return hd.default=n,hd}var fd={},QS;function TM(){if(QS)return fd;QS=1,Object.defineProperty(fd,"__esModule",{value:!0});const e=c2(),t={keyword:"$recursiveRef",schemaType:"string",code:n=>(0,e.dynamicRef)(n,n.schema)};return fd.default=t,fd}var ew;function NM(){if(ew)return dd;ew=1,Object.defineProperty(dd,"__esModule",{value:!0});const e=l2(),t=c2(),n=RM(),r=TM(),o=[e.default,t.default,n.default,r.default];return dd.default=o,dd}var pd={},md={},tw;function MM(){if(tw)return md;tw=1,Object.defineProperty(md,"__esModule",{value:!0});const e=gg(),t={keyword:"dependentRequired",type:"object",schemaType:"object",error:e.error,code:n=>(0,e.validatePropertyDeps)(n)};return md.default=t,md}var vd={},sw;function OM(){if(sw)return vd;sw=1,Object.defineProperty(vd,"__esModule",{value:!0});const e=gg(),t={keyword:"dependentSchemas",type:"object",schemaType:"object",code:n=>(0,e.validateSchemaDeps)(n)};return vd.default=t,vd}var gd={},iw;function DM(){if(iw)return gd;iw=1,Object.defineProperty(gd,"__esModule",{value:!0});const e=wt(),t={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:n,parentSchema:r,it:o}){r.contains===void 0&&(0,e.checkStrictMode)(o,`"${n}" without "contains" is ignored`)}};return gd.default=t,gd}var nw;function $M(){if(nw)return pd;nw=1,Object.defineProperty(pd,"__esModule",{value:!0});const e=MM(),t=OM(),n=DM(),r=[e.default,t.default,n.default];return pd.default=r,pd}var _d={},yd={},rw;function LM(){if(rw)return yd;rw=1,Object.defineProperty(yd,"__esModule",{value:!0});const e=ft(),t=wt(),n=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} === ${n.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 yd.default=o,yd}var bd={},aw;function IM(){if(aw)return bd;aw=1,Object.defineProperty(bd,"__esModule",{value:!0});const e=ft(),t=wt(),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 bd.default=r,bd}var ow;function PM(){if(ow)return _d;ow=1,Object.defineProperty(_d,"__esModule",{value:!0});const e=LM(),t=IM(),n=[e.default,t.default];return _d.default=n,_d}var Sd={},wd={},lw;function BM(){if(lw)return wd;lw=1,Object.defineProperty(wd,"__esModule",{value:!0});const e=ft(),n={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:r})=>(0,e.str)`must match format "${r}"`,params:({schemaCode:r})=>(0,e._)`{format: ${r}}`},code(r,o){const{gen:c,data: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)(j(),C()));function j(){return v.strictSchema===!1?e.nil:(0,e._)`${m} && !${k}`}function C(){const T=w.$async?(0,e._)`(${p}.async ? await ${k}(${f}) : ${k}(${f}))`:(0,e._)`${k}(${f})`,A=(0,e._)`(typeof ${k} == "function" ? ${T} : ${k}.test(${f}))`;return(0,e._)`${k} && ${k} !== true && ${_} === ${o} && !${A}`}}function g(){const b=R.formats[d];if(!b){j();return}if(b===!0)return;const[p,_,k]=C(b);p===o&&r.pass(T());function j(){if(v.strictSchema===!1){R.logger.warn(A());return}throw new Error(A());function A(){return`unknown format "${d}" ignored in schema at path "${S}"`}}function C(A){const M=A instanceof RegExp?(0,e.regexpCode)(A):v.code.formats?(0,e._)`${v.code.formats}${(0,e.getProperty)(d)}`:void 0,L=c.scopeValue("formats",{key:d,ref:A,code:M});return typeof A=="object"&&!(A instanceof RegExp)?[A.type||"string",A.validate,(0,e._)`${L}.validate`]:["string",A,L]}function T(){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 wd.default=n,wd}var cw;function HM(){if(cw)return Sd;cw=1,Object.defineProperty(Sd,"__esModule",{value:!0});const t=[BM().default];return Sd.default=t,Sd}var Qr={},uw;function zM(){return uw||(uw=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 dw;function UM(){if(dw)return $u;dw=1,Object.defineProperty($u,"__esModule",{value:!0});const e=iM(),t=mM(),n=AM(),r=NM(),o=$M(),c=PM(),f=HM(),l=zM(),d=[r.default,e.default,t.default,(0,n.default)(!0),f.default,l.metadataVocabulary,l.contentVocabulary,o.default,c.default];return $u.default=d,$u}var xd={},Rl={},hw;function qM(){if(hw)return Rl;hw=1,Object.defineProperty(Rl,"__esModule",{value:!0}),Rl.DiscrError=void 0;var e;return(function(t){t.Tag="tag",t.Mapping="mapping"})(e||(Rl.DiscrError=e={})),Rl}var fw;function FM(){if(fw)return xd;fw=1,Object.defineProperty(xd,"__esModule",{value:!0});const e=ft(),t=qM(),n=Ah(),r=jh(),o=wt(),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 j in k)d.elseIf((0,e._)`${g} === ${j}`),d.assign(x,p(k[j]));d.else(),l.error(!1,{discrError:t.DiscrError.Mapping,tag:g,tagName:R}),d.endIf()}function p(k){const j=d.name("valid"),C=l.subschema({keyword:"oneOf",schemaProp:k},j);return l.mergeEvaluated(C,e.Name),j}function _(){var k;const j={},C=A(v);let T=!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=n.resolveRef.call(S.self,S.schemaEnv.root,S.baseId,J),q instanceof n.SchemaEnv&&(q=q.schema),q===void 0)throw new r.default(S.opts.uriResolver,S.baseId,J)}const F=(k=q==null?void 0:q.properties)===null||k===void 0?void 0:k[R];if(typeof F!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${R}"`);T=T&&(C||A(q)),M(F,B)}if(!T)throw new Error(`discriminator: "${R}" must be required`);return j;function A({required:B}){return Array.isArray(B)&&B.includes(R)}function M(B,q){if(B.const)L(B.const,q);else if(B.enum)for(const F of B.enum)L(F,q);else throw new Error(`discriminator: "properties/${R}" must have "const" or "enum"`)}function L(B,q){if(typeof B!="string"||B in j)throw new Error(`discriminator: "${R}" values must be unique strings`);j[B]=q}}}};return xd.default=f,xd}var Cd={};const VM="https://json-schema.org/draft/2020-12/schema",WM="https://json-schema.org/draft/2020-12/schema",GM={"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},KM="meta",YM="Core and Validation specifications meta-schema",XM=[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],JM=["object","boolean"],ZM="This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",QM={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}},eO={$schema:VM,$id:WM,$vocabulary:GM,$dynamicAnchor:KM,title:YM,allOf:XM,type:JM,$comment:ZM,properties:QM},tO="https://json-schema.org/draft/2020-12/schema",sO="https://json-schema.org/draft/2020-12/meta/applicator",iO={"https://json-schema.org/draft/2020-12/vocab/applicator":!0},nO="meta",rO="Applicator vocabulary meta-schema",aO=["object","boolean"],oO={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"}},lO={schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}},cO={$schema:tO,$id:sO,$vocabulary:iO,$dynamicAnchor:nO,title:rO,type:aO,properties:oO,$defs:lO},uO="https://json-schema.org/draft/2020-12/schema",dO="https://json-schema.org/draft/2020-12/meta/unevaluated",hO={"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},fO="meta",pO="Unevaluated applicator vocabulary meta-schema",mO=["object","boolean"],vO={unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}},gO={$schema:uO,$id:dO,$vocabulary:hO,$dynamicAnchor:fO,title:pO,type:mO,properties:vO},_O="https://json-schema.org/draft/2020-12/schema",yO="https://json-schema.org/draft/2020-12/meta/content",bO={"https://json-schema.org/draft/2020-12/vocab/content":!0},SO="meta",wO="Content vocabulary meta-schema",xO=["object","boolean"],CO={contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}},EO={$schema:_O,$id:yO,$vocabulary:bO,$dynamicAnchor:SO,title:wO,type:xO,properties:CO},kO="https://json-schema.org/draft/2020-12/schema",jO="https://json-schema.org/draft/2020-12/meta/core",AO={"https://json-schema.org/draft/2020-12/vocab/core":!0},RO="meta",TO="Core vocabulary meta-schema",NO=["object","boolean"],MO={$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"}}},OO={anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}},DO={$schema:kO,$id:jO,$vocabulary:AO,$dynamicAnchor:RO,title:TO,type:NO,properties:MO,$defs:OO},$O="https://json-schema.org/draft/2020-12/schema",LO="https://json-schema.org/draft/2020-12/meta/format-annotation",IO={"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},PO="meta",BO="Format vocabulary meta-schema for annotation results",HO=["object","boolean"],zO={format:{type:"string"}},UO={$schema:$O,$id:LO,$vocabulary:IO,$dynamicAnchor:PO,title:BO,type:HO,properties:zO},qO="https://json-schema.org/draft/2020-12/schema",FO="https://json-schema.org/draft/2020-12/meta/meta-data",VO={"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},WO="meta",GO="Meta-data vocabulary meta-schema",KO=["object","boolean"],YO={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}},XO={$schema:qO,$id:FO,$vocabulary:VO,$dynamicAnchor:WO,title:GO,type:KO,properties:YO},JO="https://json-schema.org/draft/2020-12/schema",ZO="https://json-schema.org/draft/2020-12/meta/validation",QO={"https://json-schema.org/draft/2020-12/vocab/validation":!0},eD="meta",tD="Validation vocabulary meta-schema",sD=["object","boolean"],iD={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"}}},nD={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:[]}},rD={$schema:JO,$id:ZO,$vocabulary:QO,$dynamicAnchor:eD,title:tD,type:sD,properties:iD,$defs:nD};var pw;function aD(){if(pw)return Cd;pw=1,Object.defineProperty(Cd,"__esModule",{value:!0});const e=eO,t=cO,n=gO,r=EO,o=DO,c=UO,f=XO,l=rD,d=["/properties"];function m(y){return[e,t,n,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 Cd.default=m,Cd}var mw;function oD(){return mw||(mw=1,(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2020=void 0;const n=tM(),r=UM(),o=FM(),c=aD(),f="https://json-schema.org/draft/2020-12/schema";class l extends n.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=kh();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=pg();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return y.default}});var v=jh();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return v.default}})})(Tu,Tu.exports)),Tu.exports}var lD=oD();const cD=Hk(lD),u2="sapiom.studio.run-input.v1:",d2="sapiom.studio.run-target.v1:";function Rh(e,t){return`${e}${encodeURIComponent(t)}`}function Th(){try{return typeof window>"u"?null:window.localStorage}catch{return null}}function vw(e){var t;try{const n=(t=Th())==null?void 0:t.getItem(Rh(u2,e));if(!n)return null;const r=JSON.parse(n);return"value"in r?{value:r.value,schemaSignature:typeof r.schemaSignature=="string"?r.schemaSignature:null}:null}catch{return null}}function uD(e,t,n){var r;try{(r=Th())==null||r.setItem(Rh(u2,e),JSON.stringify({value:t,schemaSignature:n}))}catch{}}function gw(e){var t;try{return((t=Th())==null?void 0:t.getItem(Rh(d2,e)))==="prod"?"prod":"local"}catch{return"local"}}function dD(e,t){var n;try{(n=Th())==null||n.setItem(Rh(d2,e),t)}catch{}}function hD(e){const t=n=>Array.isArray(n)?n.map(t):n&&typeof n=="object"?Object.fromEntries(Object.entries(n).sort(([r],[o])=>r.localeCompare(o)).map(([r,o])=>[r,t(o)])):n;return JSON.stringify(t(e))}function fD(e){return Array.isArray(e.examples)&&e.examples.length>0?e.examples[0]:Object.prototype.hasOwnProperty.call(e,"example")?e.example:void 0}function h2(e){if(Object.prototype.hasOwnProperty.call(e,"default"))return e.default;if(e.type==="object"){const t=e.properties??{},n={};for(const[r,o]of Object.entries(t)){const c=h2(o);c!==void 0&&(n[r]=c)}return Object.keys(n).length>0?n:void 0}}function Mv(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 f2(e);default:return null}}function f2(e){if(e.type!=="object")return Mv(e);const t=Array.isArray(e.required)?e.required.filter(r=>typeof r=="string"):[],n=e.properties??{};return Object.fromEntries(t.map(r=>[r,Mv(n[r]??{})]))}function Bd(e){const t=Object.prototype.hasOwnProperty.call(e,"default");if(e.type!=="object")return t?e.default:void 0;if(t&&(!e.default||typeof e.default!="object"||Array.isArray(e.default)))return e.default;const n=e.properties??{},r=new Set(Array.isArray(e.required)?e.required.filter(c=>typeof c=="string"):[]),o=t?{...e.default}:{};for(const[c,f]of Object.entries(n)){if(Object.prototype.hasOwnProperty.call(o,c)){const d=o[c];f.type==="object"&&d!==null&&typeof d=="object"&&!Array.isArray(d)&&(o[c]=Bd({...f,default:d}));continue}h2(f)!==void 0?o[c]=Bd(f):r.has(c)&&(o[c]=Bd(f)??Mv(f))}return Object.keys(o).length>0?o:void 0}function co(e){const t=fD(e);if(t!==void 0)return t;const n=Bd(e);return n!==void 0?n:f2(e)}function pD(e){const t=e.nodes.find(n=>n.id===e.entry);return t?t.inputSchema?{status:"available",jsonSchema:t.inputSchema,example:co(t.inputSchema)}:{status:"none",jsonSchema:null,example:{}}:null}function mD(e){const n=new cD({allErrors:!0,strict:!1}).compile(e);return{validate:n,validateValue(r){return n(r)?[]:[...n.errors??[]]}}}function p2(e){if(e.keyword==="required"){const t=e.params.missingProperty;if(typeof t=="string")return`${e.instancePath}/${t}`}return e.instancePath||"/"}function no(e){return`${p2(e).split("/").filter(Boolean).map(n=>n.replaceAll("~1","/").replaceAll("~0","~")).join(" → ")||"Input"} ${e.message??"is invalid"}`}function Ql(e,t,n){const r={event:e,...t?{data:t}:{}};fetch("/api/track",{method:"POST",headers:{"Content-Type":"application/json","X-Harness-Token":ao()},body:JSON.stringify(r),keepalive:!0}).catch(()=>{})}const vD=[{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 gD({open:e,anchorRef:t,selected:n,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:vD.map(f=>{const l=f.id==="prod"?r:null,d=n===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 _D({workflow:e,activeSessionId:t,sessionReady:n,macros:r,onRunMacro:o,onRequestRun:c,preview:f,lastDeployError:l,authenticated:d,directActionSettleSeq:m,runningTarget:y}){const v=q=>r.find(F=>F.id===q),S=yo(e,l),w=S==="ready",R=e.definitionId!=null?yh(e.definitionId):_h,[x,g]=U.useState(null),[b,p]=U.useState(!1),[_,k]=U.useState(()=>gw(e.path)),j=U.useRef(null),C=U.useRef(null);U.useEffect(()=>{g(null)},[e.path,S,l,m]),U.useEffect(()=>{k(gw(e.path))},[e.path]);const T=[{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),A=(d?null:"Connect your account first")??R1(e,l),M=_==="prod"&&A?"local":_,L=M==="local"?"Local":"Cloud",B=q=>{q==="prod"&&A||(k(q),dD(e.path,q),p(!1),c(q,C.current))};return h.jsxs("div",{className:"session-actions","data-testid":"session-steps","aria-label":"Agent actions",...Ft({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 ${L}`,"data-tooltip":`Review input and run using ${L}`,children:[h.jsx(de,{name:"Play",size:14}),h.jsxs("span",{className:"session-step-label",children:["Run · ",L]})]}),h.jsx("button",{ref:j,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(gD,{open:b,anchorRef:j,onDismiss:()=>p(!1),selected:_,cloudDisabledReason:A,onSelect:B})]}),T.map(q=>{const F=q.needsAuth&&!d?"Connect your account first":null,J=q.needsDeploy?R1(e,l):null,te=!n&&q.macro&&I5(q.macro)?"Session is starting":null,W=F??J??te??(q.macro?P5(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),Ql("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 m2(e,t){const n=String(t).replaceAll("~","~0").replaceAll("/","~1");return`${e}/${n}`}function v2(e,t){return e.filter(n=>p2(n)===(t||"/"))}function Ov(e,t){return typeof e.title=="string"&&e.title.trim()?e.title:t??"Value"}function yD(e){return typeof e.description=="string"&&e.description.trim()?e.description:null}function bD(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"&&SD(t))}return["object","string","number","integer","boolean"].includes(String(e.type))}function SD(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 _w(e){return JSON.stringify(e??null,null,2)}function yw({value:e,onChange:t,label:n,description:r}){const o=U.useId(),c=r?`${o}-description`:void 0,f=_w(e),l=U.useRef(f),[d,m]=U.useState(f),[y,v]=U.useState(null),S=y?`${o}-error`:void 0;return U.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:n}),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=_w(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 g2({schema:e,value:t,onChange:n,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=>n(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=>n(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;n(d?y===""?void 0:Number(y):y)}})}function wD({schema:e,value:t,onChange:n,errors:r,path:o,label:c}){const f=U.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??Ov(e);return h.jsxs("div",{className:"schema-array",children:[d.map((S,w)=>{const R=m2(o??"",w),x=`${f}-${w}`,g=v2(r,R),b=g.length>0?`${x}-errors`:void 0;return h.jsxs("div",{className:"schema-array-row",children:[h.jsx(g2,{schema:l,value:S,onChange:p=>{const _=[...d];_[w]=p,n(_)},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:()=>n(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:no(p)},_))})]},w)}),h.jsxs("button",{type:"button",className:"btn-ghost schema-array-add",disabled:d.length>=y,onClick:()=>n([...d,co(l)]),children:[h.jsx(de,{name:"Plus",size:13})," Add item"]})]})}function _2({schema:e,value:t,onChange:n,errors:r,path:o="",label:c,required:f=!0}){const l=U.useId(),d=Ov(e,c),m=yD(e),y=v2(r,o);if(!bD(e))return h.jsx(yw,{value:t,onChange:n,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,j])=>{const C=m2(o,k),T=x.has(k),A=Object.prototype.hasOwnProperty.call(w,k);return h.jsxs("div",{className:"schema-property",children:[!T&&h.jsxs("label",{className:"schema-optional-toggle",children:[h.jsx("input",{type:"checkbox",checked:A,onChange:M=>{const L={...w};M.target.checked?L[k]=co(j):delete L[k],n(L)}}),"Include ",Ov(j,k)]}),(T||A)&&h.jsx(_2,{schema:j,value:w[k],onChange:M=>n({...w,[k]:M}),errors:r,path:C,label:k,required:T})]},k)}),Object.keys(g).length>0&&h.jsx(yw,{value:g,label:"Additional fields",description:"These values are not present in the current contract.",onChange:k=>{const j=k&&typeof k=="object"&&!Array.isArray(k)?k:{};n({...Object.fromEntries(Object.entries(w).filter(([C])=>C in R)),...j})}})]});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((j,C)=>h.jsx("span",{className:"schema-field-error",children:no(j)},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,j)=>h.jsx("span",{className:"schema-field-error",children:no(k)},j))})]})}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(wD,{schema:e,value:t,onChange:n,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:no(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(g2,{schema:e,value:t,onChange:n,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:no(w)},R))})]})}function Ed(e){return JSON.stringify(e??{},null,2)}function xD({workflow:e,target:t,loadContract:n,onClose:r,returnFocus:o,onRun:c}){const f=U.useRef(null),l=U.useRef(null),d=U.useRef(null),m=U.useRef(null),[y,v]=U.useState(null),[S,w]=U.useState({}),[R,x]=U.useState("{}"),[g,b]=U.useState(null),[p,_]=U.useState([]),[k,j]=U.useState(null),[C,T]=U.useState("form"),[A,M]=U.useState(!1);bo(!0,{onDismiss:r,containerRef:f}),U.useEffect(()=>()=>{o==null||o.focus()},[o]),U.useEffect(()=>{let te=!0;return v(null),b(null),n(e.path).then(W=>{if(!te)return;v(W);const se=vw(e.path);let ee=(se==null?void 0:se.value)??W.example,H=null,$=[];if(W.status==="available"){ee=(se==null?void 0:se.value)??co(W.jsonSchema);try{H=mD(W.jsonSchema),$=H.validateValue(ee)}catch{T("json"),b("This contract uses a schema branch Studio cannot render. Edit the complete JSON input instead.")}}else T("json");j(H),w(ee),_($),M(!!(se&&$.length>0)),x(Ed(ee)),requestAnimationFrame(()=>{var O,P;return(P=l.current??((O=f.current)==null?void 0:O.querySelector("input, select, textarea")))==null?void 0:P.focus()})}).catch(()=>{if(!te)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=vw(e.path),se=(W==null?void 0:W.value)??{};w(se),x(Ed(se)),T("json"),b(null),requestAnimationFrame(()=>{var ee;return(ee=l.current)==null?void 0:ee.focus()})}),()=>{te=!1}},[n,e.path]);const L=()=>{var ee;if(!y)return;let te=S;if(C==="json")try{te=JSON.parse(R)}catch(H){b(H instanceof Error?H.message:"Enter valid JSON."),(ee=l.current)==null||ee.focus();return}const W=(k==null?void 0:k.validateValue(te))??[];if(_(W),W.length>0){b("Fix the highlighted input before running.");return}const se=y.status==="available"?hD(y.jsonSchema):null;uD(e.path,te,se),b(null),c(te)},B=te=>{w(te),x(Ed(te));const W=(k==null?void 0:k.validateValue(te))??[];_(W),W.length===0&&(b(null),M(!1))},q=te=>{if(te===C)return!0;if(te==="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(Ed(S)),b(null);return T(te),!0},F=(y==null?void 0:y.status)==="available"&&k!==null,J=te=>{var se;if(!["ArrowLeft","ArrowRight","Home","End"].includes(te.key))return;te.preventDefault();const W=te.key==="Home"?"form":te.key==="End"||C==="form"?"json":"form";q(W)&&((se=(W==="form"?d:m).current)==null||se.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:te=>{var W;if(te.key==="Tab"){const se=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($=>$.offsetParent!==null),ee=se[0],H=se[se.length-1];ee&&H&&te.shiftKey&&document.activeElement===ee?(te.preventDefault(),H.focus()):ee&&H&&!te.shiftKey&&document.activeElement===H&&(te.preventDefault(),ee.focus())}te.key==="Enter"&&(te.metaKey||te.ctrlKey)&&(te.preventDefault(),L())},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"}),F?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:F?"tabpanel":void 0,"aria-labelledby":F?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}),A&&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(co(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(_2,{schema:y.jsonSchema,value:S,onChange:B,errors:p}),!A&&h.jsx("button",{type:"button",className:"btn-ghost run-sheet-reset",onClick:()=>B(co(y.jsonSchema)),children:"Reset to defaults"})]}):h.jsx("textarea",{id:"run-sheet-json",ref:l,className:"run-sheet-editor",value:R,onChange:te=>{x(te.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((te,W)=>h.jsx("li",{children:no(te)},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:L,"data-testid":"run-sheet-submit",children:[h.jsx(de,{name:"Play",size:14}),"Run ",t==="local"?"locally":"in cloud"]})]})]})})}function CD({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 uo="(none)",bw={query:"",category:null,cadence:null};function ED(e){return e.query.trim()!==""||e.category!==null||e.cadence!==null}const kD={"on-demand":"On demand",scheduled:"Scheduled","on-event":"On event","on-webhook":"Webhook"};function y2(e){return e?kD[e]??e.replace(/-/g," ").replace(/^./,t=>t.toUpperCase()):"No trigger declared"}function b2(e,t,n){const r=new Map;for(const o of e){const c=t(o)??uo;r.set(c,(r.get(c)??0)+1)}return[...r.entries()].map(([o,c])=>({value:o,label:n(o),count:c})).sort((o,c)=>o.value===uo?1:c.value===uo?-1:c.count-o.count||o.label.localeCompare(c.label))}function jD(e){return b2(e,t=>t.category,t=>t===uo?"Uncategorised":o5(t))}function AD(e){return b2(e,t=>t.cadence,t=>t===uo?"No trigger declared":y2(t))}function Sw(e,t){return t===null?!0:t===uo?e===null:e===t}function RD(e,t,n){return e.filter(r=>n(r,t.query)&&Sw(r.category,t.category)&&Sw(r.cadence,t.cadence))}function Hd({children:e,variant:t="tag",title:n}){return h.jsx("span",{className:t==="count"?"pill pill--count":"pill",title:n,children:e})}const ww=3;function TD({template:e,onPreview:t,onUse:n}){const[r,o]=U.useState(!1),c=U.useRef(null),f=[{term:"Steps",value:String(e.stepCount)},{term:"Trigger",value:e.cadence?y2(e.cadence):"Not declared"},{term:"Complexity",value:hg(e.complexity),...e.complexity?{title:l5(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),n(e)},children:"Use"})]})]})]})}function xw({template:e,onOpen:t,onUse:n}){const r=e.kind==="gallery"?e.tags.slice(0,ww):[],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(TD,{template:e,onPreview:t,onUse:n})]}),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(Hd,{children:"bundled"})}):r.length>0&&h.jsxs("div",{className:"template-card-tags",children:[r.map(c=>h.jsx(Hd,{children:c},c)),o>0&&h.jsxs(Hd,{variant:"count",title:e.tags.slice(ww).join(", "),children:["+",o]})]})]})}function ND({detail:e}){const t=d5(e);return h.jsx("div",{className:"template-graph","data-testid":"template-graph",children:t.nodes.map(n=>{const r=t.edges.filter(o=>o.from===n.id);return h.jsxs("div",{className:"template-graph-item","data-testid":`template-graph-node-${n.id}`,children:[h.jsxs("div",{className:"template-graph-node",children:[h.jsx("span",{className:"canvas-step-dot dot--"+n.kind,"aria-hidden":"true"}),h.jsx("span",{className:"template-graph-name",children:n.label}),n.kind==="terminal-success"&&h.jsx("span",{className:"template-step-exit",children:"exit"}),n.kind==="terminal-warn"&&h.jsx("span",{className:"template-step-exit template-step-exit--warn",children:"fails out"}),n.kind==="pause"&&h.jsx("span",{className:"template-step-pause",children:"pause"}),n.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}`))]},n.id)})})}function MD({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 OD({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(ND,{detail:e}),h.jsx("ol",{className:"template-steps",children:e.steps.map((t,n)=>h.jsxs("li",{className:"template-step",children:[h.jsx("span",{className:"template-step-index","aria-hidden":"true",children:n+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:hg(e.complexity)})," —"," ",KC(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,n)=>h.jsx(MD,{example:t,index:n},t.title??n))]}),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(JC,{text:e.notes})})]})]})}function DD({template:e,getTemplate:t}){const[n,r]=U.useState(null),[o,c]=U.useState(null);return U.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",...Ft({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:[(n==null?void 0:n.author)&&h.jsxs("span",{className:"template-byline",children:["By"," ",n.author.url?h.jsx("a",{href:n.author.url,target:"_blank",rel:"noopener noreferrer",children:n.author.name}):n.author.name]}),!n&&!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]}),n&&h.jsx(OD,{detail:n})]}):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 Cw({title:e,allLabel:t,allCount:n,options:r,value:o,onSelect:c,testIdPrefix:f}){if(r.length<2)return null;const l=[{value:"",label:t,count:n,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(Hd,{variant:"count",children:d.count})]},d.testId)})})]})}function $D({catalog:e,filter:t,onChange:n}){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=>n({...t,query:r.target.value})})]}),h.jsx(Cw,{title:"Category",allLabel:"All templates",allCount:e.length,options:jD(e),value:t.category,onSelect:r=>n({...t,category:r}),testIdPrefix:"templates-category"}),h.jsx(Cw,{title:"Trigger",allLabel:"Any trigger",allCount:e.length,options:AD(e),value:t.cadence,onSelect:r=>n({...t,cadence:r}),testIdPrefix:"templates-cadence"})]})}function LD(){return typeof window>"u"?void 0:window}function xr(e=LD()){const t=e==null?void 0:e.sapiomDesktop;if(!t||typeof t!="object")return null;const n=t;return typeof n.checkForUpdates!="function"?null:{appVersion:typeof n.appVersion=="string"?n.appVersion:"",checkForUpdates:n.checkForUpdates,chooseDirectory:typeof n.chooseDirectory=="function"?n.chooseDirectory:void 0,onDeepLink:typeof n.onDeepLink=="function"?n.onDeepLink:void 0,onUpdateState:typeof n.onUpdateState=="function"?n.onUpdateState:void 0,pathForFile:typeof n.pathForFile=="function"?n.pathForFile:void 0}}function S2(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 w2({value:e,onChange:t,onSubmit:n,recentDirs:r,listDir:o,onNewDirChange:c,onResolve:f}){var P;const[l,d]=U.useState(e),[m,y]=U.useState([]),[v,S]=U.useState(e),[w,R]=U.useState(!1),[x,g]=U.useState(null),[b,p]=U.useState(0),[_,k]=U.useState(!0),[j,C]=U.useState(!1),[T,A]=U.useState(0),M=U.useRef(null),[L,B]=U.useState("none"),q=()=>{const z=M.current;if(!z)return;const I=z.scrollLeft>2,G=z.scrollLeft+z.clientWidth<z.scrollWidth-2;B(I&&G?"both":I?"left":G?"right":"none")};U.useEffect(()=>{q()},[r]),U.useEffect(()=>{let z=!1;R(!0),g(null),C(!1);const I=setTimeout(()=>{o(e||void 0).then(G=>{z||(d(G.path),y(G.dirs),S(G.parent))}).catch(async()=>{const G=FC(e);if(!G||z){z||g("Couldn't read that directory.");return}try{const ie=await o(G);if(z)return;d(ie.path),y(ie.dirs),S(ie.parent),C(!0)}catch{z||g("Couldn't read that directory.")}}).finally(()=>!z&&R(!1))},150);return()=>{z=!0,clearTimeout(I)}},[e,T]);const F=z=>z.replace(/\\/g,"/"),J=F(e).startsWith(F(l))?e.slice(l.length).replace(/^[\\/]+/,""):"",te=J?m.filter(z=>z.name.toLowerCase().startsWith(J.toLowerCase())):m,W=Math.min(b,Math.max(te.length-1,0)),se=!w&&!x&&te.length===0&&(j||J!=="");U.useEffect(()=>{c==null||c(se)},[se]),U.useEffect(()=>{w||x||f==null||f({resolvedPath:l,dirs:m,parent:v,isNew:se})},[l,m,v,se,w,x]);const ee=z=>t(z),H=((P=xr())==null?void 0:P.chooseDirectory)??null,$=()=>{if(H){H(e||l||void 0).then(z=>{z&&t(z)}).catch(()=>{});return}if(!_){k(!0);return}se&&l&&l!==e?ee(l):k(!1)},O=z=>{var G;const I=_&&te.length>0;z.key==="ArrowDown"&&I?(z.preventDefault(),p(Math.min(W+1,te.length-1))):z.key==="ArrowUp"&&I?(z.preventDefault(),p(Math.max(W-1,0))):z.key==="Enter"&&(I?(ee(((G=te[W])==null?void 0:G.path)??te[0].path),p(0)):n())};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:()=>ee(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:z=>t(z.target.value),onKeyDown:O}),h.jsx("button",{type:"button",className:"dir-picker-up dir-picker-browse"+(!H&&_?" is-active":""),"data-testid":"dir-picker-browse","aria-pressed":H?void 0:_,onClick:$,"aria-label":H?"Choose a folder":"Browse subdirectories","data-tooltip":H?"Choose a folder…":_?se?"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":L,onScroll:q,children:r.map(z=>h.jsx("button",{type:"button",className:"recent-dir-chip",title:z,onClick:()=>ee(z),children:B4(z)},z))}),_&&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:()=>A(z=>z+1),children:"Retry"})]}),se&&h.jsx("div",{className:"dir-picker-newdir","data-testid":"dir-picker-newdir",children:"New folder. It will be created when you start."}),!w&&!x&&!se&&te.length===0&&h.jsx("div",{className:"dir-picker-empty",children:"No subdirectories"}),!w&&!x&&te.map((z,I)=>h.jsxs("button",{type:"button",className:"dir-picker-item"+(I===W?" is-selected":""),"data-testid":`dir-picker-item-${z.name}`,onMouseEnter:()=>p(I),onClick:()=>ee(z.path),...Ft({object:"directory"}),children:[h.jsx(de,{name:"Folder",size:13}),h.jsx("span",{className:"dir-picker-item-name",children:z.name}),z.hasAgentProject&&h.jsxs("span",{className:"dir-picker-item-badge","data-testid":`dir-picker-badge-${z.name}`,title:"Contains sapiom.json",children:[h.jsx(de,{name:"Check",size:11}),"Agent"]})]},z.path))]})]})}function ID({template:e,initialDest:t,recentDirs:n,listDir:r,onCancel:o,onConfirm:c,triggerRef:f}){const[l,d]=U.useState(t),[m,y]=U.useState(!1),[v,S]=U.useState(null),w=U.useRef(null);bo(!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}`,...Ft({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(w2,{value:l,onChange:d,onSubmit:()=>void R(),recentDirs:n,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 x2({children:e,...t}){return h.jsx("div",{style:{display:"contents"},...Ft(t),children:e})}function PD({projectRoot:e,recentDirs:t,listDir:n,onExit:r,onUse:o,listTemplates:c,getTemplate:f,openTemplateId:l}){const[d,m]=U.useState(null),[y,v]=U.useState(null),[S,w]=U.useState(bw),[R,x]=U.useState(null),[g,b]=U.useState(null),p=U.useRef(null);U.useEffect(()=>{let M=!1;return c().then(L=>{M||m(L)}).catch(L=>{M||v(L instanceof Error?L.message:String(L))}),()=>{M=!0}},[]);const _=U.useMemo(()=>((d==null?void 0:d.templates)??[]).map(M=>({...M,kind:"gallery"})),[d]),k=U.useMemo(()=>RD(_,S,I1),[_,S]),j=U.useMemo(()=>S.category!==null||S.cadence!==null?[]:hh.filter(M=>I1(M,S.query)),[S]),C=U.useRef(null);U.useEffect(()=>{if(!l||C.current===l)return;const M=_.find(L=>L.id===l)??hh.find(L=>L.id===l);M&&(C.current=l,x(M))},[l,_]);const T=d===null&&y===null,A=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",...Ft({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(DD,{template:R,getTemplate:f}):h.jsxs(x2,{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:T?"Loading the catalog…":`${_.length} runnable agents. Open one to read what it does, then use it. A session starts in a new folder and sets it up for you.`})]}),A&&h.jsxs("div",{className:"templates-degraded","data-testid":"templates-degraded",role:"status",children:[h.jsx(de,{name:"TriangleAlert",size:14}),h.jsx("span",{children:A})]}),h.jsxs("div",{className:"templates-layout",children:[h.jsx($D,{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(xw,{template:M,onOpen:x,onUse:b},M.id))}),k.length===0&&!T&&_.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:ED(S)?h.jsx("button",{type:"button",className:"btn-line","data-testid":"templates-empty-clear",onClick:()=>w(bw),children:"Clear filters"}):void 0}),j.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:j.map(M=>h.jsx(xw,{template:M,onOpen:x,onUse:b},M.id))})]})]})]})]})})}),g&&h.jsx(ID,{template:g,initialDest:h5(g,e),recentDirs:t,listDir:n,onCancel:()=>b(null),triggerRef:p,onConfirm:async M=>{await o(M,g),r()}})]})}var Nm={exports:{}},Ew;function BD(){return Ew||(Ew=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(f,l,d){var m=this&&this.__decorate||function(p,_,k,j){var C,T=arguments.length,A=T<3?_:j===null?j=Object.getOwnPropertyDescriptor(_,k):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(p,_,k,j);else for(var M=p.length-1;M>=0;M--)(C=p[M])&&(A=(T<3?C(A):T>3?C(_,k,A):C(_,k))||A);return T>3&&A&&Object.defineProperty(_,k,A),A},y=this&&this.__param||function(p,_){return function(k,j){_(k,j,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,j){super(),this._terminal=p,this._coreBrowserService=k,this._renderService=j,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,j=k.lines.length.toString();for(let C=p;C<=_;C++){const T=k.lines.get(k.ydisp+C),A=[],M=(T==null?void 0:T.translateToString(!0,void 0,void 0,A))||"",L=(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,A)),B.setAttribute("aria-posinset",L),B.setAttribute("aria-setsize",j))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(p,_){const k=p.target,j=this._rowElements[_===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(_===0?"1":`${this._terminal.buffer.lines.length}`)||p.relatedTarget!==j)return;let C,T;if(_===0?(C=k,T=this._rowElements.pop(),this._rowContainer.removeChild(T)):(C=this._rowElements.shift(),T=k,this._rowContainer.removeChild(C)),C.removeEventListener("focus",this._topBoundaryFocusListener),T.removeEventListener("focus",this._bottomBoundaryFocusListener),_===0){const A=this._createAccessibilityTreeNode();this._rowElements.unshift(A),this._rowContainer.insertAdjacentElement("afterbegin",A)}else{const A=this._createAccessibilityTreeNode();this._rowElements.push(A),this._rowContainer.appendChild(A)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(_===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 j=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(j)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:j,offset:((M=j.textContent)==null?void 0:M.length)??0}),!this._rowContainer.contains(k.node))return;const C=({node:L,offset:B})=>{const q=L instanceof Text?L.parentNode:L;let F=parseInt(q==null?void 0:q.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;const J=this._rowColumns.get(q);if(!J)return console.warn("columns is null. Race condition?"),null;let te=B<J.length?J[B]:J.slice(-1)[0]+1;return te>=this._terminal.cols&&(++F,te=0),{row:F,column:te}},T=C(_),A=C(k);if(T&&A){if(T.row>A.row||T.row===A.row&&T.column>=A.column)throw new Error("invalid range");this._terminal.select(T.column,T.row,(A.row-T.row)*this._terminal.cols-T.column+A.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 j,C=arguments.length,T=C<3?p:k===null?k=Object.getOwnPropertyDescriptor(p,_):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,p,_,k);else for(var A=b.length-1;A>=0;A--)(j=b[A])&&(T=(C<3?j(T):C>3?j(p,_,T):j(p,_))||T);return C>3&&T&&Object.defineProperty(p,_,T),T},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,j){super(),this._element=b,this._mouseService=p,this._renderService=_,this._bufferService=k,this._linkProviderService=j,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 j=_[k];if(j.classList.contains("xterm"))break;if(j.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,j;this._activeProviderReplies&&p||((k=this._activeProviderReplies)==null||k.forEach((C=>{C==null||C.forEach((T=>{T.link.dispose&&T.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let _=!1;for(const[C,T]of this._linkProviderService.linkProviders.entries())p?(j=this._activeProviderReplies)!=null&&j.get(C)&&(_=this._checkLinkProviderResult(C,b,_)):T.provideLinks(b.y,(A=>{var L,B;if(this._isMouseOut)return;const M=A==null?void 0:A.map((q=>({link:q})));(L=this._activeProviderReplies)==null||L.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 j=p.get(k);if(j)for(let C=0;C<j.length;C++){const T=j[C],A=T.link.range.start.y<b?0:T.link.range.start.x,M=T.link.range.end.y>b?this._bufferService.cols:T.link.range.end.x;for(let L=A;L<=M;L++){if(_.has(L)){j.splice(C--,1);break}_.add(L)}}}}_checkLinkProviderResult(b,p,_){var C;if(!this._activeProviderReplies)return _;const k=this._activeProviderReplies.get(b);let j=!1;for(let T=0;T<b;T++)this._activeProviderReplies.has(T)&&!this._activeProviderReplies.get(T)||(j=!0);if(!j&&k){const T=k.find((A=>this._linkAtPosition(A.link,p)));T&&(_=!0,this._handleNewLink(T))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!_)for(let T=0;T<this._activeProviderReplies.size;T++){const A=(C=this._activeProviderReplies.get(T))==null?void 0:C.find((M=>this._linkAtPosition(M.link,p)));if(A){_=!0,this._handleNewLink(A);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,j,C;(k=this._currentLink)!=null&&k.state&&((C=(j=this._currentLink)==null?void 0:j.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,j=this._bufferService.buffer.ydisp+1+_.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=j&&(this._clearCurrentLink(k,j),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,j=this._createLinkUnderlineEvent(_.start.x-1,_.start.y-k-1,_.end.x,_.end.y-k-1,void 0);(p?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(j)}_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,j=p.y*this._bufferService.cols+p.x;return _<=j&&j<=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,j){return{x1:b,y1:p,x2:_,y2:k,cols:this._bufferService.cols,fg:j}}};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,j=k<3?g:p===null?p=Object.getOwnPropertyDescriptor(g,b):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(x,g,b,p);else for(var C=x.length-1;C>=0;C--)(_=x[C])&&(j=(k<3?_(j):k>3?_(g,b,j):_(g,b))||j);return k>3&&j&&Object.defineProperty(g,b,j),j},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,j=b.getTrimmedLength();let C=-1,T=-1,A=!1;for(let L=0;L<j;L++)if(T!==-1||b.hasContent(L)){if(b.loadCell(L,k),k.hasExtendedAttrs()&&k.extended.urlId){if(T===-1){T=L,C=k.extended.urlId;continue}A=k.extended.urlId!==C}else T!==-1&&(A=!0);if(A||T!==-1&&L===j-1){const B=(M=this._oscLinkService.getLinkData(C))==null?void 0:M.uri;if(B){const q={start:{x:T+1,y:x},end:{x:L+(A||L!==j-1?0:1),y:x}};let F=!1;if(!(_!=null&&_.allowNonHttpProtocols))try{const J=new URL(B);["http:","https:"].includes(J.protocol)||(F=!0)}catch{F=!0}F||p.push({text:B,range:q,activate:(J,te)=>_?_.activate(J,te,q):R(0,te),hover:(J,te)=>{var W;return(W=_==null?void 0:_.hover)==null?void 0:W.call(_,J,te,q)},leave:(J,te)=>{var W;return(W=_==null?void 0:_.leave)==null?void 0:W.call(_,J,te,q)}})}A=!1,k.hasExtendedAttrs()&&k.extended.urlId?(T=L,C=k.extended.urlId):(T=-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),j=d(5114),C=d(8934),T=d(3230),A=d(9312),M=d(4725),L=d(6731),B=d(8055),q=d(8969),F=d(8460),J=d(844),te=d(6114),W=d(8437),se=d(2584),ee=d(7399),H=d(5941),$=d(9074),O=d(2585),P=d(5435),z=d(4567),I=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(X={}){super(X),this.browser=te,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new J.MutableDisposable),this._onCursorMove=this.register(new F.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new F.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new F.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new F.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new F.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new F.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new F.EventEmitter),this._onBlur=this.register(new F.EventEmitter),this._onA11yCharEmitter=this.register(new F.EventEmitter),this._onA11yTabEmitter=this.register(new F.EventEmitter),this._onWillOpen=this.register(new F.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance($.DecorationService),this._instantiationService.setService(O.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(I.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(((V,ce)=>this.refresh(V,ce)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((V=>this._reportWindowsOptions(V)))),this.register(this._inputHandler.onColor((V=>this._handleColorEvent(V)))),this.register((0,F.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,F.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((V=>this._afterResize(V.cols,V.rows)))),this.register((0,J.toDisposable)((()=>{var V,ce;this._customKeyEventHandler=void 0,(ce=(V=this.element)==null?void 0:V.parentNode)==null||ce.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const V of X){let ce,ae="";switch(V.index){case 256:ce="foreground",ae="10";break;case 257:ce="background",ae="11";break;case 258:ce="cursor",ae="12";break;default:ce="ansi",ae="4;"+V.index}switch(V.type){case 0:const Y=B.color.toColorRGB(ce==="ansi"?this._themeService.colors.ansi[V.index]:this._themeService.colors[ce]);this.coreService.triggerDataEvent(`${se.C0.ESC}]${ae};${(0,H.toRgbString)(Y)}${se.C1_ESCAPED.ST}`);break;case 1:if(ce==="ansi")this._themeService.modifyColors((Z=>Z.ansi[V.index]=B.channels.toColor(...V.color)));else{const Z=ce;this._themeService.modifyColors((ue=>ue[Z]=B.channels.toColor(...V.color)))}break;case 2:this._themeService.restoreColor(V.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(X){X?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(z.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(X){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(se.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var X;return(X=this.textarea)==null?void 0:X.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(se.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const X=this.buffer.ybase+this.buffer.y,V=this.buffer.lines.get(X);if(!V)return;const ce=Math.min(this.buffer.x,this.cols-1),ae=this._renderService.dimensions.css.cell.height,Y=V.getWidth(ce),Z=this._renderService.dimensions.css.cell.width*Y,ue=this.buffer.y*this._renderService.dimensions.css.cell.height,we=ce*this._renderService.dimensions.css.cell.width;this.textarea.style.left=we+"px",this.textarea.style.top=ue+"px",this.textarea.style.width=Z+"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",(V=>{this.hasSelection()&&(0,m.copyHandler)(V,this._selectionService)})));const X=V=>(0,m.handlePasteEvent)(V,this.textarea,this.coreService,this.optionsService);this.register((0,y.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,y.addDisposableDomListener)(this.element,"paste",X)),te.isFirefox?this.register((0,y.addDisposableDomListener)(this.element,"mousedown",(V=>{V.button===2&&(0,m.rightClickHandler)(V,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,y.addDisposableDomListener)(this.element,"contextmenu",(V=>{(0,m.rightClickHandler)(V,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),te.isLinux&&this.register((0,y.addDisposableDomListener)(this.element,"auxclick",(V=>{V.button===1&&(0,m.moveTextAreaUnderMouseCursor)(V,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,y.addDisposableDomListener)(this.textarea,"keyup",(X=>this._keyUp(X)),!0)),this.register((0,y.addDisposableDomListener)(this.textarea,"keydown",(X=>this._keyDown(X)),!0)),this.register((0,y.addDisposableDomListener)(this.textarea,"keypress",(X=>this._keyPress(X)),!0)),this.register((0,y.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,y.addDisposableDomListener)(this.textarea,"compositionupdate",(X=>this._compositionHelper.compositionupdate(X)))),this.register((0,y.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,y.addDisposableDomListener)(this.textarea,"input",(X=>this._inputEvent(X)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(X){var ce;if(!X)throw new Error("Terminal requires a parent element.");if(X.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ce=this.element)==null?void 0:ce.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=X.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),X.appendChild(this.element);const V=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),V.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,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),V.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",S.promptLabel),te.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(j.CoreBrowserService,this.textarea,X.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(M.ICoreBrowserService,this._coreBrowserService),this.register((0,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(L.ThemeService),this._instantiationService.setService(M.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.CharacterJoinerService),this._instantiationService.setService(M.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(T.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(M.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((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(V);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(A.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(z.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 X=this,V=this.element;function ce(Z){const ue=X._mouseService.getMouseReportCoords(Z,X.screenElement);if(!ue)return!1;let we,Ae;switch(Z.overrideType||Z.type){case"mousemove":Ae=32,Z.buttons===void 0?(we=3,Z.button!==void 0&&(we=Z.button<3?Z.button:3)):we=1&Z.buttons?0:4&Z.buttons?1:2&Z.buttons?2:3;break;case"mouseup":Ae=0,we=Z.button<3?Z.button:3;break;case"mousedown":Ae=1,we=Z.button<3?Z.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(Z)===!1||X.viewport.getLinesScrolled(Z)===0)return!1;Ae=Z.deltaY<0?0:1,we=4;break;default:return!1}return!(Ae===void 0||we===void 0||we>4)&&X.coreMouseService.triggerMouseEvent({col:ue.col,row:ue.row,x:ue.x,y:ue.y,button:we,action:Ae,ctrl:Z.ctrlKey,alt:Z.altKey,shift:Z.shiftKey})}const ae={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Y={mouseup:Z=>(ce(Z),Z.buttons||(this._document.removeEventListener("mouseup",ae.mouseup),ae.mousedrag&&this._document.removeEventListener("mousemove",ae.mousedrag)),this.cancel(Z)),wheel:Z=>(ce(Z),this.cancel(Z,!0)),mousedrag:Z=>{Z.buttons&&ce(Z)},mousemove:Z=>{Z.buttons||ce(Z)}};this.register(this.coreMouseService.onProtocolChange((Z=>{Z?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Z)),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&Z?ae.mousemove||(V.addEventListener("mousemove",Y.mousemove),ae.mousemove=Y.mousemove):(V.removeEventListener("mousemove",ae.mousemove),ae.mousemove=null),16&Z?ae.wheel||(V.addEventListener("wheel",Y.wheel,{passive:!1}),ae.wheel=Y.wheel):(V.removeEventListener("wheel",ae.wheel),ae.wheel=null),2&Z?ae.mouseup||(ae.mouseup=Y.mouseup):(this._document.removeEventListener("mouseup",ae.mouseup),ae.mouseup=null),4&Z?ae.mousedrag||(ae.mousedrag=Y.mousedrag):(this._document.removeEventListener("mousemove",ae.mousedrag),ae.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,y.addDisposableDomListener)(V,"mousedown",(Z=>{if(Z.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Z))return ce(Z),ae.mouseup&&this._document.addEventListener("mouseup",ae.mouseup),ae.mousedrag&&this._document.addEventListener("mousemove",ae.mousedrag),this.cancel(Z)}))),this.register((0,y.addDisposableDomListener)(V,"wheel",(Z=>{if(!ae.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(Z)===!1)return!1;if(!this.buffer.hasScrollback){const ue=this.viewport.getLinesScrolled(Z);if(ue===0)return;const we=se.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Z.deltaY<0?"A":"B");let Ae="";for(let Ie=0;Ie<Math.abs(ue);Ie++)Ae+=we;return this.coreService.triggerDataEvent(Ae,!0),this.cancel(Z,!0)}return this.viewport.handleWheel(Z)?this.cancel(Z):void 0}}),{passive:!1})),this.register((0,y.addDisposableDomListener)(V,"touchstart",(Z=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Z),this.cancel(Z)}),{passive:!0})),this.register((0,y.addDisposableDomListener)(V,"touchmove",(Z=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Z)?void 0:this.cancel(Z)}),{passive:!1}))}refresh(X,V){var ce;(ce=this._renderService)==null||ce.refreshRows(X,V)}updateCursorStyle(X){var V;(V=this._selectionService)!=null&&V.shouldColumnSelect(X)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(X,V,ce=0){var ae;ce===1?(super.scrollLines(X,V,ce),this.refresh(0,this.rows-1)):(ae=this.viewport)==null||ae.scrollLines(X)}paste(X){(0,m.paste)(X,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(X){this._customKeyEventHandler=X}attachCustomWheelEventHandler(X){this._customWheelEventHandler=X}registerLinkProvider(X){return this._linkProviderService.registerLinkProvider(X)}registerCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const V=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),V}deregisterCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(X)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(X){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+X)}registerDecoration(X){return this._decorationService.registerDecoration(X)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(X,V,ce){this._selectionService.setSelection(X,V,ce)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var X;(X=this._selectionService)==null||X.clearSelection()}selectAll(){var X;(X=this._selectionService)==null||X.selectAll()}selectLines(X,V){var ce;(ce=this._selectionService)==null||ce.selectLines(X,V)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const V=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!V&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;V||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ce=(0,ee.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),ce.type===3||ce.type===2){const ae=this.rows-1;return this.scrollLines(ce.type===2?-ae:ae),this.cancel(X,!0)}return ce.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(ce.cancel&&this.cancel(X,!0),!ce.key||!!(X.key&&!X.ctrlKey&&!X.altKey&&!X.metaKey&&X.key.length===1&&X.key.charCodeAt(0)>=65&&X.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ce.key!==se.C0.ETX&&ce.key!==se.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ce.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(ce.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,V){const ce=X.isMac&&!this.options.macOptionIsMeta&&V.altKey&&!V.ctrlKey&&!V.metaKey||X.isWindows&&V.altKey&&V.ctrlKey&&!V.metaKey||X.isWindows&&V.getModifierState("AltGraph");return V.type==="keypress"?ce:ce&&(!V.keyCode||V.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(V){return V.keyCode===16||V.keyCode===17||V.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let V;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)V=X.charCode;else if(X.which===null||X.which===void 0)V=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;V=X.which}return!(!V||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(V=String.fromCharCode(V),this._onKey.fire({key:V,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(V,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(X){if(X.data&&X.inputType==="insertText"&&(!X.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const V=X.data;return this.coreService.triggerDataEvent(V,!0),this.cancel(X),!0}return!1}resize(X,V){X!==this.cols||V!==this.rows?super.resize(X,V):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,V){var ce,ae;(ce=this._charSizeService)==null||ce.measure(),(ae=this.viewport)==null||ae.syncScrollArea(!0)}clear(){var X;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let V=1;V<this.rows;V++)this.buffer.lines.push(this.buffer.getBlankLine(W.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(X=this.viewport)==null||X.reset(),this.refresh(0,this.rows-1)}}reset(){var V,ce;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(V=this._selectionService)==null||V.reset(),this._decorationService.reset(),(ce=this.viewport)==null||ce.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var X;(X=this._renderService)==null||X.clearTextureAtlas()}_reportFocus(){var X;(X=this.element)!=null&&X.classList.contains("focus")?this.coreService.triggerDataEvent(se.C0.ESC+"[I"):this.coreService.triggerDataEvent(se.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){case P.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const V=this._renderService.dimensions.css.canvas.width.toFixed(0),ce=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${se.C0.ESC}[4;${ce};${V}t`);break;case P.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const ae=this._renderService.dimensions.css.cell.width.toFixed(0),Y=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${se.C0.ESC}[6;${Y};${ae}t`)}}cancel(X,V){if(this.options.cancelEvents||V)return X.preventDefault(),X.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 j,C=arguments.length,T=C<3?p:k===null?k=Object.getOwnPropertyDescriptor(p,_):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,p,_,k);else for(var A=b.length-1;A>=0;A--)(j=b[A])&&(T=(C<3?j(T):C>3?j(p,_,T):j(p,_))||T);return C>3&&T&&Object.defineProperty(p,_,T),T},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,j,C,T,A){super(),this._viewportElement=b,this._scrollArea=p,this._bufferService=_,this._optionsService=k,this._charSizeService=j,this._renderService=C,this._coreBrowserService=T,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new 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(A.colors),this.register(A.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 A;let _,k="";const j=[],C=p??this._bufferService.buffer.lines.length,T=this._bufferService.buffer.lines;for(let M=b;M<C;M++){const L=T.get(M);if(!L)continue;const B=(A=T.get(M+1))==null?void 0:A.isWrapped;if(k+=L.translateToString(!B),!B||M===T.length-1){const q=document.createElement("div");q.textContent=k,j.push(q),k.length>0&&(_=q),k=""}}return{bufferElements:j,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,j=k<3?g:p===null?p=Object.getOwnPropertyDescriptor(g,b):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(x,g,b,p);else for(var C=x.length-1;C>=0;C--)(_=x[C])&&(j=(k<3?_(j):k>3?_(g,b,j):_(g,b))||j);return k>3&&j&&Object.defineProperty(g,b,j),j},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,j,C){var T,A=arguments.length,M=A<3?k:C===null?C=Object.getOwnPropertyDescriptor(k,j):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(_,k,j,C);else for(var L=_.length-1;L>=0;L--)(T=_[L])&&(M=(A<3?T(M):A>3?T(k,j,M):T(k,j))||M);return A>3&&M&&Object.defineProperty(k,j,M),M},y=this&&this.__param||function(_,k){return function(j,C){k(j,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,j,C,T,A,M){var B;super(),this._viewportElement=_,this._screenElement=k,this._bufferService=j,this._decorationService=C,this._renderService=T,this._optionsService=A,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 L=this._canvas.getContext("2d");if(!L)throw new Error("Ctx cannot be null");this._ctx=L,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,j=k<3?g:p===null?p=Object.getOwnPropertyDescriptor(g,b):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(x,g,b,p);else for(var C=x.length-1;C>=0;C--)(_=x[C])&&(j=(k<3?_(j):k>3?_(g,b,j):_(g,b))||j);return k>3&&j&&Object.defineProperty(g,b,j),j},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),j=b-v(b,p),C=Math.abs(k-j)-(function(T,A,M){let L=0;const B=T-v(T,M),q=A-v(A,M);for(let F=0;F<Math.abs(B-q);F++){const J=S(T,A)==="A"?-1:1,te=M.buffer.lines.get(B+J*F);te!=null&&te.isWrapped&&L++}return L})(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,j){let C=g,T=b,A="";for(;C!==p||T!==_;)C+=k?1:-1,k&&C>j.cols-1?(A+=j.buffer.translateBufferLineToString(T,!1,g,C),C=0,g=0,T++):!k&&C<0&&(A+=j.buffer.translateBufferLineToString(T,!1,0,g+1),C=j.cols-1,g=C,T--);return A+j.buffer.translateBufferLineToString(T,!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,j=p.buffer.y;if(!p.buffer.hasScrollback)return(function(A,M,L,B,q,F){return y(M,B,q,F).length===0?"":x(w(A,M,A,M-v(M,q),!1,q).length,R("D",F))})(k,j,0,b,p,_)+y(j,b,p,_)+(function(A,M,L,B,q,F){let J;J=y(M,B,q,F).length>0?B-v(B,q):M;const te=B,W=(function(se,ee,H,$,O,P){let z;return z=y(H,$,O,P).length>0?$-v($,O):ee,se<H&&z<=$||se>=H&&z<$?"C":"D"})(A,M,L,B,q,F);return x(w(A,J,L,te,W==="C",q).length,R(W,F))})(k,j,g,b,p,_);let C;if(j===b)return C=k>g?"D":"C",x(Math.abs(k-g),R(C,_));C=j>b?"D":"C";const T=Math.abs(j-b);return x((function(A,M){return M.cols-A})(j>b?g:k,p)+(T-1)*p.cols+1+((j>b?k:g)-1),R(C,_))}},1296:function(f,l,d){var m=this&&this.__decorate||function(F,J,te,W){var se,ee=arguments.length,H=ee<3?J:W===null?W=Object.getOwnPropertyDescriptor(J,te):W;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(F,J,te,W);else for(var $=F.length-1;$>=0;$--)(se=F[$])&&(H=(ee<3?se(H):ee>3?se(J,te,H):se(J,te))||H);return ee>3&&H&&Object.defineProperty(J,te,H),H},y=this&&this.__param||function(F,J){return function(te,W){J(te,W,F)}};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),j="xterm-dom-renderer-owner-",C="xterm-rows",T="xterm-fg-",A="xterm-bg-",M="xterm-focus",L="xterm-selection";let B=1,q=l.DomRenderer=class extends _.Disposable{constructor(F,J,te,W,se,ee,H,$,O,P,z,I,G){super(),this._terminal=F,this._document=J,this._element=te,this._screenElement=W,this._viewportElement=se,this._helperContainer=ee,this._linkifier2=H,this._charSizeService=O,this._optionsService=P,this._bufferService=z,this._coreBrowserService=I,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(L),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((ie=>this._injectCss(ie)))),this._injectCss(this._themeService.colors),this._rowFactory=$.createInstance(v.DomRendererRowFactory,document),this._element.classList.add(j+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ie=>this._handleLinkHover(ie)))),this.register(this._linkifier2.onHideLinkUnderline((ie=>this._handleLinkLeave(ie)))),this.register((0,_.toDisposable)((()=>{this._element.classList.remove(j+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new S.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const F=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*F,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*F),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/F),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/F),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const te of this._rowElements)te.style.width=`${this.dimensions.css.canvas.width}px`,te.style.height=`${this.dimensions.css.cell.height}px`,te.style.lineHeight=`${this.dimensions.css.cell.height}px`,te.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(F){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let J=`${this._terminalSelector} .${C} { color: ${F.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(F.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 te=`blink_underline_${this._terminalClass}`,W=`blink_bar_${this._terminalClass}`,se=`blink_block_${this._terminalClass}`;J+=`@keyframes ${te} { 50% { border-bottom-style: hidden; }}`,J+=`@keyframes ${W} { 50% { box-shadow: none; }}`,J+=`@keyframes ${se} { 0% { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css}; } 50% { background-color: inherit; color: ${F.cursor.css}; }}`,J+=`${this._terminalSelector} .${C}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${te} 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: ${se} 1s step-end infinite;}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-block { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css};}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${F.cursor.css} !important; color: ${F.cursorAccent.css} !important;}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${F.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${F.cursor.css} inset;}${this._terminalSelector} .${C} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${F.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,J+=`${this._terminalSelector} .${L} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${L} div { position: absolute; background-color: ${F.selectionBackgroundOpaque.css};}${this._terminalSelector} .${L} div { position: absolute; background-color: ${F.selectionInactiveBackgroundOpaque.css};}`;for(const[ee,H]of F.ansi.entries())J+=`${this._terminalSelector} .${T}${ee} { color: ${H.css}; }${this._terminalSelector} .${T}${ee}.xterm-dim { color: ${b.color.multiplyOpacity(H,.5).css}; }${this._terminalSelector} .${A}${ee} { background-color: ${H.css}; }`;J+=`${this._terminalSelector} .${T}${w.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(F.background).css}; }${this._terminalSelector} .${T}${w.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(F.background),.5).css}; }${this._terminalSelector} .${A}${w.INVERTED_DEFAULT_COLOR} { background-color: ${F.foreground.css}; }`,this._themeStyleElement.textContent=J}_setDefaultSpacing(){const F=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${F}px`,this._rowFactory.defaultSpacing=F}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(F,J){for(let te=this._rowElements.length;te<=J;te++){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(F,J){this._refreshRowElements(F,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(F,J,te){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(F,J,te),this.renderRows(0,this._bufferService.rows-1),!F||!J)return;this._selectionRenderModel.update(this._terminal,F,J,te);const W=this._selectionRenderModel.viewportStartRow,se=this._selectionRenderModel.viewportEndRow,ee=this._selectionRenderModel.viewportCappedStartRow,H=this._selectionRenderModel.viewportCappedEndRow;if(ee>=this._bufferService.rows||H<0)return;const $=this._document.createDocumentFragment();if(te){const O=F[0]>J[0];$.appendChild(this._createSelectionElement(ee,O?J[0]:F[0],O?F[0]:J[0],H-ee+1))}else{const O=W===ee?F[0]:0,P=ee===se?J[0]:this._bufferService.cols;$.appendChild(this._createSelectionElement(ee,O,P));const z=H-ee-1;if($.appendChild(this._createSelectionElement(ee+1,0,this._bufferService.cols,z)),ee!==H){const I=se===H?J[0]:this._bufferService.cols;$.appendChild(this._createSelectionElement(H,0,I))}}this._selectionContainer.appendChild($)}_createSelectionElement(F,J,te,W=1){const se=this._document.createElement("div"),ee=J*this.dimensions.css.cell.width;let H=this.dimensions.css.cell.width*(te-J);return ee+H>this.dimensions.css.canvas.width&&(H=this.dimensions.css.canvas.width-ee),se.style.height=W*this.dimensions.css.cell.height+"px",se.style.top=F*this.dimensions.css.cell.height+"px",se.style.left=`${ee}px`,se.style.width=`${H}px`,se}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const F of this._rowElements)F.replaceChildren()}renderRows(F,J){const te=this._bufferService.buffer,W=te.ybase+te.y,se=Math.min(te.x,this._bufferService.cols-1),ee=this._optionsService.rawOptions.cursorBlink,H=this._optionsService.rawOptions.cursorStyle,$=this._optionsService.rawOptions.cursorInactiveStyle;for(let O=F;O<=J;O++){const P=O+te.ydisp,z=this._rowElements[O],I=te.lines.get(P);if(!z||!I)break;z.replaceChildren(...this._rowFactory.createRow(I,P,P===W,H,$,se,ee,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${j}${this._terminalClass}`}_handleLinkHover(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!0)}_handleLinkLeave(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!1)}_setCellUnderline(F,J,te,W,se,ee){te<0&&(F=0),W<0&&(J=0);const H=this._bufferService.rows-1;te=Math.max(Math.min(te,H),0),W=Math.max(Math.min(W,H),0),se=Math.min(se,this._bufferService.cols);const $=this._bufferService.buffer,O=$.ybase+$.y,P=Math.min($.x,se-1),z=this._optionsService.rawOptions.cursorBlink,I=this._optionsService.rawOptions.cursorStyle,G=this._optionsService.rawOptions.cursorInactiveStyle;for(let ie=te;ie<=W;++ie){const X=ie+$.ydisp,V=this._rowElements[ie],ce=$.lines.get(X);if(!V||!ce)break;V.replaceChildren(...this._rowFactory.createRow(ce,X,X===O,I,G,P,z,this.dimensions.css.cell.width,this._widthCache,ee?ie===te?F:0:-1,ee?(ie===W?J:se)-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,T,A,M){var L,B=arguments.length,q=B<3?T:M===null?M=Object.getOwnPropertyDescriptor(T,A):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(C,T,A,M);else for(var F=C.length-1;F>=0;F--)(L=C[F])&&(q=(B<3?L(q):B>3?L(T,A,q):L(T,A))||q);return B>3&&q&&Object.defineProperty(T,A,q),q},y=this&&this.__param||function(C,T){return function(A,M){T(A,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,T,A,M,L,B,q){this._document=C,this._characterJoinerService=T,this._optionsService=A,this._coreBrowserService=M,this._coreService=L,this._decorationService=B,this._themeService=q,this._workCell=new w.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(C,T,A){this._selectionStart=C,this._selectionEnd=T,this._columnSelectMode=A}createRow(C,T,A,M,L,B,q,F,J,te,W){const se=[],ee=this._characterJoinerService.getJoinedCharacters(T),H=this._themeService.colors;let $,O=C.getNoBgTrimmedLength();A&&O<B+1&&(O=B+1);let P=0,z="",I=0,G=0,ie=0,X=!1,V=0,ce=!1,ae=0;const Y=[],Z=te!==-1&&W!==-1;for(let ue=0;ue<O;ue++){C.loadCell(ue,this._workCell);let we=this._workCell.getWidth();if(we===0)continue;let Ae=!1,Ie=ue,$e=this._workCell;if(ee.length>0&&ue===ee[0][0]){Ae=!0;const gt=ee.shift();$e=new b.JoinedCellData(this._workCell,C.translateToString(!0,gt[0],gt[1]),gt[1]-gt[0]),Ie=gt[1]-1,we=$e.getWidth()}const ct=this._isCellInSelection(ue,T),ut=A&&ue===B,mt=Z&&ue>=te&&ue<=W;let et=!1;this._decorationService.forEachDecorationAtCell(ue,T,void 0,(gt=>{et=!0}));let vt=$e.getChars()||S.WHITESPACE_CELL_CHAR;if(vt===" "&&($e.isUnderline()||$e.isOverline())&&(vt=" "),ae=we*F-J.get(vt,$e.isBold(),$e.isItalic()),$){if(P&&(ct&&ce||!ct&&!ce&&$e.bg===I)&&(ct&&ce&&H.selectionForeground||$e.fg===G)&&$e.extended.ext===ie&&mt===X&&ae===V&&!ut&&!Ae&&!et){$e.isInvisible()?z+=S.WHITESPACE_CELL_CHAR:z+=vt,P++;continue}P&&($.textContent=z),$=this._document.createElement("span"),P=0,z=""}else $=this._document.createElement("span");if(I=$e.bg,G=$e.fg,ie=$e.extended.ext,X=mt,V=ae,ce=ct,Ae&&B>=ue&&B<=Ie&&(B=ue),!this._coreService.isCursorHidden&&ut&&this._coreService.isCursorInitialized){if(Y.push("xterm-cursor"),this._coreBrowserService.isFocused)q&&Y.push("xterm-cursor-blink"),Y.push(M==="bar"?"xterm-cursor-bar":M==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(L)switch(L){case"outline":Y.push("xterm-cursor-outline");break;case"block":Y.push("xterm-cursor-block");break;case"bar":Y.push("xterm-cursor-bar");break;case"underline":Y.push("xterm-cursor-underline")}}if($e.isBold()&&Y.push("xterm-bold"),$e.isItalic()&&Y.push("xterm-italic"),$e.isDim()&&Y.push("xterm-dim"),z=$e.isInvisible()?S.WHITESPACE_CELL_CHAR:$e.getChars()||S.WHITESPACE_CELL_CHAR,$e.isUnderline()&&(Y.push(`xterm-underline-${$e.extended.underlineStyle}`),z===" "&&(z=" "),!$e.isUnderlineColorDefault()))if($e.isUnderlineColorRGB())$.style.textDecorationColor=`rgb(${_.AttributeData.toColorRGB($e.getUnderlineColor()).join(",")})`;else{let gt=$e.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&$e.isBold()&><8&&(gt+=8),$.style.textDecorationColor=H.ansi[gt].css}$e.isOverline()&&(Y.push("xterm-overline"),z===" "&&(z=" ")),$e.isStrikethrough()&&Y.push("xterm-strikethrough"),mt&&($.style.textDecoration="underline");let tt=$e.getFgColor(),Ke=$e.getFgColorMode(),Ot=$e.getBgColor(),jt=$e.getBgColorMode();const fs=!!$e.isInverse();if(fs){const gt=tt;tt=Ot,Ot=gt;const _s=Ke;Ke=jt,jt=_s}let Dt,xt,gs,It=!1;switch(this._decorationService.forEachDecorationAtCell(ue,T,void 0,(gt=>{gt.options.layer!=="top"&&It||(gt.backgroundColorRGB&&(jt=50331648,Ot=gt.backgroundColorRGB.rgba>>8&16777215,Dt=gt.backgroundColorRGB),gt.foregroundColorRGB&&(Ke=50331648,tt=gt.foregroundColorRGB.rgba>>8&16777215,xt=gt.foregroundColorRGB),It=gt.options.layer==="top")})),!It&&ct&&(Dt=this._coreBrowserService.isFocused?H.selectionBackgroundOpaque:H.selectionInactiveBackgroundOpaque,Ot=Dt.rgba>>8&16777215,jt=50331648,It=!0,H.selectionForeground&&(Ke=50331648,tt=H.selectionForeground.rgba>>8&16777215,xt=H.selectionForeground)),It&&Y.push("xterm-decoration-top"),jt){case 16777216:case 33554432:gs=H.ansi[Ot],Y.push(`xterm-bg-${Ot}`);break;case 50331648:gs=x.channels.toColor(Ot>>16,Ot>>8&255,255&Ot),this._addStyle($,`background-color:#${j((Ot>>>0).toString(16),"0",6)}`);break;default:fs?(gs=H.foreground,Y.push(`xterm-bg-${v.INVERTED_DEFAULT_COLOR}`)):gs=H.background}switch(Dt||$e.isDim()&&(Dt=x.color.multiplyOpacity(gs,.5)),Ke){case 16777216:case 33554432:$e.isBold()&&tt<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(tt+=8),this._applyMinimumContrast($,gs,H.ansi[tt],$e,Dt,void 0)||Y.push(`xterm-fg-${tt}`);break;case 50331648:const gt=x.channels.toColor(tt>>16&255,tt>>8&255,255&tt);this._applyMinimumContrast($,gs,gt,$e,Dt,xt)||this._addStyle($,`color:#${j(tt.toString(16),"0",6)}`);break;default:this._applyMinimumContrast($,gs,H.foreground,$e,Dt,xt)||fs&&Y.push(`xterm-fg-${v.INVERTED_DEFAULT_COLOR}`)}Y.length&&($.className=Y.join(" "),Y.length=0),ut||Ae||et?$.textContent=z:P++,ae!==this.defaultSpacing&&($.style.letterSpacing=`${ae}px`),se.push($),ue=Ie}return $&&P&&($.textContent=z),se}_applyMinimumContrast(C,T,A,M,L,B){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,p.treatGlyphAsBackgroundColor)(M.getCode()))return!1;const q=this._getContrastCache(M);let F;if(L||B||(F=q.getColor(T.rgba,A.rgba)),F===void 0){const J=this._optionsService.rawOptions.minimumContrastRatio/(M.isDim()?2:1);F=x.color.ensureContrastRatio(L||T,B||A,J),q.setColor((L||T).rgba,(B||A).rgba,F??null)}return!!F&&(this._addStyle(C,`color:${F.css}`),!0)}_getContrastCache(C){return C.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(C,T){C.setAttribute("style",`${C.getAttribute("style")||""}${T};`)}_isCellInSelection(C,T){const A=this._selectionStart,M=this._selectionEnd;return!(!A||!M)&&(this._columnSelectMode?A[0]<=M[0]?C>=A[0]&&T>=A[1]&&C<M[0]&&T<=M[1]:C<A[0]&&T>=A[1]&&C>=M[0]&&T<=M[1]:T>A[1]&&T<M[1]||A[1]===M[1]&&T===A[1]&&C>=A[0]&&C<M[0]||A[1]<M[1]&&T===M[1]&&C<M[0]||A[1]<M[1]&&T===A[1]&&C>=A[0])}};function j(C,T,A){for(;C.length<A;)C=T+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,j){var C,T=arguments.length,A=T<3?_:j===null?j=Object.getOwnPropertyDescriptor(_,k):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(p,_,k,j);else for(var M=p.length-1;M>=0;M--)(C=p[M])&&(A=(T<3?C(A):T>3?C(_,k,A):C(_,k))||A);return T>3&&A&&Object.defineProperty(_,k,A),A},y=this&&this.__param||function(p,_){return function(k,j){_(k,j,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,j){super(),this._document=_,this._parentElement=k,this._optionsService=j,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 j,C=arguments.length,T=C<3?p:k===null?k=Object.getOwnPropertyDescriptor(p,_):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,p,_,k);else for(var A=b.length-1;A>=0;A--)(j=b[A])&&(T=(C<3?j(T):C>3?j(p,_,T):j(p,_))||T);return C>3&&T&&Object.defineProperty(p,_,T),T},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 C2{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=[],j=_.translateToString(!0);let C=0,T=0,A=0,M=_.getFg(0),L=_.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!==L){if(B-C>1){const q=this._getJoinedRanges(j,A,T,_,C);for(let F=0;F<q.length;F++)k.push(q[F])}C=B,A=T,M=this._workCell.fg,L=this._workCell.bg}T+=this._workCell.getChars().length||S.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-C>1){const B=this._getJoinedRanges(j,A,T,_,C);for(let q=0;q<B.length;q++)k.push(B[q])}return k}_getJoinedRanges(p,_,k,j,C){const T=p.substring(_,k);let A=[];try{A=this._characterJoiners[0].handler(T)}catch(M){console.error(M)}for(let M=1;M<this._characterJoiners.length;M++)try{const L=this._characterJoiners[M].handler(T);for(let B=0;B<L.length;B++)C2._mergeRanges(A,L[B])}catch(L){console.error(L)}return this._stringRangesToCellRanges(A,j,C),A}_stringRangesToCellRanges(p,_,k){let j=0,C=!1,T=0,A=p[j];if(A){for(let M=k;M<this._bufferService.cols;M++){const L=_.getWidth(M),B=_.getString(M).length||S.WHITESPACE_CELL_CHAR.length;if(L!==0){if(!C&&A[0]<=T&&(A[0]=M,C=!0),A[1]<=T){if(A[1]=M,A=p[++j],!A)break;A[0]<=T?(A[0]=M,C=!0):C=!1}T+=B}}A&&(A[1]=this._bufferService.cols)}}static _mergeRanges(p,_){let k=!1;for(let j=0;j<p.length;j++){const C=p[j];if(k){if(_[1]<=C[0])return p[j-1][1]=_[1],p;if(_[1]<=C[1])return p[j-1][1]=Math.max(_[1],C[1]),p.splice(j,1),p;p.splice(j,1),j--}else{if(_[1]<=C[0])return p.splice(j,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 j=R.length-1;j>=0;j--)(p=R[j])&&(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,j){var C,T=arguments.length,A=T<3?_:j===null?j=Object.getOwnPropertyDescriptor(_,k):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(p,_,k,j);else for(var M=p.length-1;M>=0;M--)(C=p[M])&&(A=(T<3?C(A):T>3?C(_,k,A):C(_,k))||A);return T>3&&A&&Object.defineProperty(_,k,A),A},y=this&&this.__param||function(p,_){return function(k,j){_(k,j,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,j,C,T,A,M){super(),this._rowCount=p,this._charSizeService=j,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(((L,B)=>this._renderRows(L,B)),A),this.register(this._renderDebouncer),this.register(A.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(T.onResize((()=>this._fullRefresh()))),this.register(T.buffers.onBufferActivate((()=>{var L;return(L=this._renderer.value)==null?void 0:L.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(T.cols,T.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(T.buffer.y,T.buffer.y,!0)))),this.register(M.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(A.window,_),this.register(A.onWindowChange((L=>this._registerIntersectionObserver(L,_))))}_registerIntersectionObserver(p,_){if("IntersectionObserver"in p){const k=new p.IntersectionObserver((j=>this._handleIntersectionChange(j[j.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 j;this._selectionState.start=p,this._selectionState.end=_,this._selectionState.columnSelectMode=k,(j=this._renderer.value)==null||j.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(A,M,L,B){var q,F=arguments.length,J=F<3?M:B===null?B=Object.getOwnPropertyDescriptor(M,L):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")J=Reflect.decorate(A,M,L,B);else for(var te=A.length-1;te>=0;te--)(q=A[te])&&(J=(F<3?q(J):F>3?q(M,L,J):q(M,L))||J);return F>3&&J&&Object.defineProperty(M,L,J),J},y=this&&this.__param||function(A,M){return function(L,B){M(L,B,A)}};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),j=" ",C=new RegExp(j,"g");let T=l.SelectionService=class extends g.Disposable{constructor(A,M,L,B,q,F,J,te,W){super(),this._element=A,this._screenElement=M,this._linkifier=L,this._bufferService=B,this._coreService=q,this._mouseService=F,this._optionsService=J,this._renderService=te,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=se=>this._handleMouseMove(se),this._mouseUpListener=se=>this._handleMouseUp(se),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((se=>this._handleTrim(se))),this.register(this._bufferService.buffers.onBufferActivate((se=>this._handleBufferActivate(se)))),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 A=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!A||!M||A[0]===M[0]&&A[1]===M[1])}get selectionText(){const A=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;if(!A||!M)return"";const L=this._bufferService.buffer,B=[];if(this._activeSelectionMode===3){if(A[0]===M[0])return"";const q=A[0]<M[0]?A[0]:M[0],F=A[0]<M[0]?M[0]:A[0];for(let J=A[1];J<=M[1];J++){const te=L.translateBufferLineToString(J,!0,q,F);B.push(te)}}else{const q=A[1]===M[1]?M[0]:void 0;B.push(L.translateBufferLineToString(A[1],!0,A[0],q));for(let F=A[1]+1;F<=M[1]-1;F++){const J=L.lines.get(F),te=L.translateBufferLineToString(F,!0);J!=null&&J.isWrapped?B[B.length-1]+=te:B.push(te)}if(A[1]!==M[1]){const F=L.lines.get(M[1]),J=L.translateBufferLineToString(M[1],!0,0,M[0]);F&&F.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(A){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&A&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(A){const M=this._getMouseBufferCoords(A),L=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!!(L&&B&&M)&&this._areCoordsInSelection(M,L,B)}isCellInSelection(A,M){const L=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!L||!B)&&this._areCoordsInSelection([A,M],L,B)}_areCoordsInSelection(A,M,L){return A[1]>M[1]&&A[1]<L[1]||M[1]===L[1]&&A[1]===M[1]&&A[0]>=M[0]&&A[0]<L[0]||M[1]<L[1]&&A[1]===L[1]&&A[0]<L[0]||M[1]<L[1]&&A[1]===M[1]&&A[0]>=M[0]}_selectWordAtCursor(A,M){var q,F;const L=(F=(q=this._linkifier.currentLink)==null?void 0:q.link)==null?void 0:F.range;if(L)return this._model.selectionStart=[L.start.x-1,L.start.y-1],this._model.selectionStartLength=(0,p.getRangeLength)(L,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const B=this._getMouseBufferCoords(A);return!!B&&(this._selectWordAt(B,M),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(A,M){this._model.clearSelection(),A=Math.max(A,0),M=Math.min(M,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,A],this._model.selectionEnd=[this._bufferService.cols,M],this.refresh(),this._onSelectionChange.fire()}_handleTrim(A){this._model.handleTrim(A)&&this.refresh()}_getMouseBufferCoords(A){const M=this._mouseService.getCoords(A,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(M)return M[0]--,M[1]--,M[1]+=this._bufferService.buffer.ydisp,M}_getMouseEventScrollAmount(A){let M=(0,v.getCoordsRelativeToElement)(this._coreBrowserService.window,A,this._screenElement)[1];const L=this._renderService.dimensions.css.canvas.height;return M>=0&&M<=L?0:(M>L&&(M-=L),M=Math.min(Math.max(M,-50),50),M/=50,M/Math.abs(M)+Math.round(14*M))}shouldForceSelection(A){return b.isMac?A.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:A.shiftKey}handleMouseDown(A){if(this._mouseDownTimeStamp=A.timeStamp,(A.button!==2||!this.hasSelection)&&A.button===0){if(!this._enabled){if(!this.shouldForceSelection(A))return;A.stopPropagation()}A.preventDefault(),this._dragScrollAmount=0,this._enabled&&A.shiftKey?this._handleIncrementalClick(A):A.detail===1?this._handleSingleClick(A):A.detail===2?this._handleDoubleClick(A):A.detail===3&&this._handleTripleClick(A),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(A){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(A))}_handleSingleClick(A){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(A)?3:0,this._model.selectionStart=this._getMouseBufferCoords(A),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const 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(A){this._selectWordAtCursor(A,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(A){const M=this._getMouseBufferCoords(A);M&&(this._activeSelectionMode=2,this._selectLineAt(M[1]))}shouldColumnSelect(A){return A.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(A){if(A.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(A),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(A),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const L=this._bufferService.buffer;if(this._model.selectionEnd[1]<L.lines.length){const B=L.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 A=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(A.ydisp+this._bufferService.rows,A.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=A.ydisp),this.refresh()}}_handleMouseUp(A){const M=A.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&M<500&&A.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const L=this._mouseService.getCoords(A,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(L&&L[0]!==void 0&&L[1]!==void 0){const B=(0,S.moveToCellSequence)(L[0]-1,L[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const A=this._model.finalSelectionStart,M=this._model.finalSelectionEnd,L=!(!A||!M||A[0]===M[0]&&A[1]===M[1]);L?A&&M&&(this._oldSelectionStart&&this._oldSelectionEnd&&A[0]===this._oldSelectionStart[0]&&A[1]===this._oldSelectionStart[1]&&M[0]===this._oldSelectionEnd[0]&&M[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(A,M,L)):this._oldHasSelection&&this._fireOnSelectionChange(A,M,L)}_fireOnSelectionChange(A,M,L){this._oldSelectionStart=A,this._oldSelectionEnd=M,this._oldHasSelection=L,this._onSelectionChange.fire()}_handleBufferActivate(A){this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim((M=>this._handleTrim(M)))}_convertViewportColToCharacterIndex(A,M){let L=M;for(let B=0;M>=B;B++){const q=A.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?L--:q>1&&M!==B&&(L+=q-1)}return L}setSelection(A,M,L){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,M],this._model.selectionStartLength=L,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(A){this._isClickInSelection(A)||(this._selectWordAtCursor(A,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(A,M,L=!0,B=!0){if(A[0]>=this._bufferService.cols)return;const q=this._bufferService.buffer,F=q.lines.get(A[1]);if(!F)return;const J=q.translateBufferLineToString(A[1],!1);let te=this._convertViewportColToCharacterIndex(F,A[0]),W=te;const se=A[0]-te;let ee=0,H=0,$=0,O=0;if(J.charAt(te)===" "){for(;te>0&&J.charAt(te-1)===" ";)te--;for(;W<J.length&&J.charAt(W+1)===" ";)W++}else{let I=A[0],G=A[0];F.getWidth(I)===0&&(ee++,I--),F.getWidth(G)===2&&(H++,G++);const ie=F.getString(G).length;for(ie>1&&(O+=ie-1,W+=ie-1);I>0&&te>0&&!this._isCharWordSeparator(F.loadCell(I-1,this._workCell));){F.loadCell(I-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(ee++,I--):X>1&&($+=X-1,te-=X-1),te--,I--}for(;G<F.length&&W+1<J.length&&!this._isCharWordSeparator(F.loadCell(G+1,this._workCell));){F.loadCell(G+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(H++,G++):X>1&&(O+=X-1,W+=X-1),W++,G++}}W++;let P=te+se-ee+$,z=Math.min(this._bufferService.cols,W-te+ee+H-$-O);if(M||J.slice(te,W).trim()!==""){if(L&&P===0&&F.getCodePoint(0)!==32){const I=q.lines.get(A[1]-1);if(I&&F.isWrapped&&I.getCodePoint(this._bufferService.cols-1)!==32){const G=this._getWordAt([this._bufferService.cols-1,A[1]-1],!1,!0,!1);if(G){const ie=this._bufferService.cols-G.start;P-=ie,z+=ie}}}if(B&&P+z===this._bufferService.cols&&F.getCodePoint(this._bufferService.cols-1)!==32){const I=q.lines.get(A[1]+1);if(I!=null&&I.isWrapped&&I.getCodePoint(0)!==32){const G=this._getWordAt([0,A[1]+1],!1,!1,!0);G&&(z+=G.length)}}return{start:P,length:z}}}_selectWordAt(A,M){const L=this._getWordAt(A,M);if(L){for(;L.start<0;)L.start+=this._bufferService.cols,A[1]--;this._model.selectionStart=[L.start,A[1]],this._model.selectionStartLength=L.length}}_selectToWordAt(A){const M=this._getWordAt(A,!0);if(M){let L=A[1];for(;M.start<0;)M.start+=this._bufferService.cols,L--;if(!this._model.areSelectionValuesReversed())for(;M.start+M.length>this._bufferService.cols;)M.length-=this._bufferService.cols,L++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?M.start:M.start+M.length,L]}}_isCharWordSeparator(A){return A.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(A.getChars())>=0}_selectLineAt(A){const M=this._bufferService.buffer.getWrappedRangeForLine(A),L={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)(L,this._bufferService.cols)}};l.SelectionService=T=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)],T)},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(T,A,M,L){var B,q=arguments.length,F=q<3?A:L===null?L=Object.getOwnPropertyDescriptor(A,M):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(T,A,M,L);else for(var J=T.length-1;J>=0;J--)(B=T[J])&&(F=(q<3?B(F):q>3?B(A,M,F):B(A,M))||F);return q>3&&F&&Object.defineProperty(A,M,F),F},y=this&&this.__param||function(T,A){return function(M,L){A(M,L,T)}};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 T=[S.css.toColor("#2e3436"),S.css.toColor("#cc0000"),S.css.toColor("#4e9a06"),S.css.toColor("#c4a000"),S.css.toColor("#3465a4"),S.css.toColor("#75507b"),S.css.toColor("#06989a"),S.css.toColor("#d3d7cf"),S.css.toColor("#555753"),S.css.toColor("#ef2929"),S.css.toColor("#8ae234"),S.css.toColor("#fce94f"),S.css.toColor("#729fcf"),S.css.toColor("#ad7fa8"),S.css.toColor("#34e2e2"),S.css.toColor("#eeeeec")],A=[0,95,135,175,215,255];for(let M=0;M<216;M++){const L=A[M/36%6|0],B=A[M/6%6|0],q=A[M%6];T.push({css:S.channels.toCss(L,B,q),rgba:S.channels.toRgba(L,B,q)})}for(let M=0;M<24;M++){const L=8+10*M;T.push({css:S.channels.toCss(L,L,L),rgba:S.channels.toRgba(L,L,L)})}return T})());let j=l.ThemeService=class extends R.Disposable{get colors(){return this._colors}constructor(T){super(),this._optionsService=T,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(T={}){const A=this._colors;if(A.foreground=C(T.foreground,g),A.background=C(T.background,b),A.cursor=C(T.cursor,p),A.cursorAccent=C(T.cursorAccent,_),A.selectionBackgroundTransparent=C(T.selectionBackground,k),A.selectionBackgroundOpaque=S.color.blend(A.background,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundTransparent=C(T.selectionInactiveBackground,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundOpaque=S.color.blend(A.background,A.selectionInactiveBackgroundTransparent),A.selectionForeground=T.selectionForeground?C(T.selectionForeground,S.NULL_COLOR):void 0,A.selectionForeground===S.NULL_COLOR&&(A.selectionForeground=void 0),S.color.isOpaque(A.selectionBackgroundTransparent)&&(A.selectionBackgroundTransparent=S.color.opacity(A.selectionBackgroundTransparent,.3)),S.color.isOpaque(A.selectionInactiveBackgroundTransparent)&&(A.selectionInactiveBackgroundTransparent=S.color.opacity(A.selectionInactiveBackgroundTransparent,.3)),A.ansi=l.DEFAULT_ANSI_COLORS.slice(),A.ansi[0]=C(T.black,l.DEFAULT_ANSI_COLORS[0]),A.ansi[1]=C(T.red,l.DEFAULT_ANSI_COLORS[1]),A.ansi[2]=C(T.green,l.DEFAULT_ANSI_COLORS[2]),A.ansi[3]=C(T.yellow,l.DEFAULT_ANSI_COLORS[3]),A.ansi[4]=C(T.blue,l.DEFAULT_ANSI_COLORS[4]),A.ansi[5]=C(T.magenta,l.DEFAULT_ANSI_COLORS[5]),A.ansi[6]=C(T.cyan,l.DEFAULT_ANSI_COLORS[6]),A.ansi[7]=C(T.white,l.DEFAULT_ANSI_COLORS[7]),A.ansi[8]=C(T.brightBlack,l.DEFAULT_ANSI_COLORS[8]),A.ansi[9]=C(T.brightRed,l.DEFAULT_ANSI_COLORS[9]),A.ansi[10]=C(T.brightGreen,l.DEFAULT_ANSI_COLORS[10]),A.ansi[11]=C(T.brightYellow,l.DEFAULT_ANSI_COLORS[11]),A.ansi[12]=C(T.brightBlue,l.DEFAULT_ANSI_COLORS[12]),A.ansi[13]=C(T.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),A.ansi[14]=C(T.brightCyan,l.DEFAULT_ANSI_COLORS[14]),A.ansi[15]=C(T.brightWhite,l.DEFAULT_ANSI_COLORS[15]),T.extendedAnsi){const M=Math.min(A.ansi.length-16,T.extendedAnsi.length);for(let L=0;L<M;L++)A.ansi[L+16]=C(T.extendedAnsi[L],l.DEFAULT_ANSI_COLORS[L+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(T){this._restoreColor(T),this._onChangeColors.fire(this.colors)}_restoreColor(T){if(T!==void 0)switch(T){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[T]=this._restoreColors.ansi[T]}else for(let A=0;A<this._restoreColors.ansi.length;++A)this._colors.ansi[A]=this._restoreColors.ansi[A]}modifyColors(T){T(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function C(T,A){if(T!==void 0)try{return S.css.toColor(T)}catch{}return A}l.ThemeService=j=m([y(0,x.IOptionsService)],j)},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,j,C,T){return T!==void 0?`#${b(k)}${b(j)}${b(C)}${b(T)}`:`#${b(k)}${b(j)}${b(C)}`},_.toRgba=function(k,j,C,T=255){return(k<<24|j<<16|C<<8|T)>>>0},_.toColor=function(k,j,C,T){return{css:_.toCss(k,j,C,T),rgba:_.toRgba(k,j,C,T)}}})(S||(l.channels=S={})),(function(_){function k(j,C){return v=Math.round(255*C),[d,m,y]=g.toChannels(j.rgba),{css:S.toCss(d,m,y,v),rgba:S.toRgba(d,m,y,v)}}_.blend=function(j,C){if(v=(255&C.rgba)/255,v===1)return{css:C.css,rgba:C.rgba};const T=C.rgba>>24&255,A=C.rgba>>16&255,M=C.rgba>>8&255,L=j.rgba>>24&255,B=j.rgba>>16&255,q=j.rgba>>8&255;return d=L+Math.round((T-L)*v),m=B+Math.round((A-B)*v),y=q+Math.round((M-q)*v),{css:S.toCss(d,m,y),rgba:S.toRgba(d,m,y)}},_.isOpaque=function(j){return(255&j.rgba)==255},_.ensureContrastRatio=function(j,C,T){const A=g.ensureContrastRatio(j.rgba,C.rgba,T);if(A)return S.toColor(A>>24&255,A>>16&255,A>>8&255)},_.opaque=function(j){const C=(255|j.rgba)>>>0;return[d,m,y]=g.toChannels(C),{css:S.toCss(d,m,y),rgba:C}},_.opacity=k,_.multiplyOpacity=function(j,C){return v=255&j.rgba,k(j,v*C/255)},_.toColorRGB=function(j){return[j.rgba>>24&255,j.rgba>>16&255,j.rgba>>8&255]}})(w||(l.color=w={})),(function(_){let k,j;try{const C=document.createElement("canvas");C.width=1,C.height=1;const T=C.getContext("2d",{willReadFrequently:!0});T&&(k=T,k.globalCompositeOperation="copy",j=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 T=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(T)return d=parseInt(T[1]),m=parseInt(T[2]),y=parseInt(T[3]),v=Math.round(255*(T[5]===void 0?1:parseFloat(T[5]))),S.toColor(d,m,y,v);if(!k||!j)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=j,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(j,C,T){const A=j/255,M=C/255,L=T/255;return .2126*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))+.7152*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}_.relativeLuminance=function(j){return k(j>>16&255,j>>8&255,255&j)},_.relativeLuminance2=k})(x||(l.rgb=x={})),(function(_){function k(C,T,A){const M=C>>24&255,L=C>>16&255,B=C>>8&255;let q=T>>24&255,F=T>>16&255,J=T>>8&255,te=p(x.relativeLuminance2(q,F,J),x.relativeLuminance2(M,L,B));for(;te<A&&(q>0||F>0||J>0);)q-=Math.max(0,Math.ceil(.1*q)),F-=Math.max(0,Math.ceil(.1*F)),J-=Math.max(0,Math.ceil(.1*J)),te=p(x.relativeLuminance2(q,F,J),x.relativeLuminance2(M,L,B));return(q<<24|F<<16|J<<8|255)>>>0}function j(C,T,A){const M=C>>24&255,L=C>>16&255,B=C>>8&255;let q=T>>24&255,F=T>>16&255,J=T>>8&255,te=p(x.relativeLuminance2(q,F,J),x.relativeLuminance2(M,L,B));for(;te<A&&(q<255||F<255||J<255);)q=Math.min(255,q+Math.ceil(.1*(255-q))),F=Math.min(255,F+Math.ceil(.1*(255-F))),J=Math.min(255,J+Math.ceil(.1*(255-J))),te=p(x.relativeLuminance2(q,F,J),x.relativeLuminance2(M,L,B));return(q<<24|F<<16|J<<8|255)>>>0}_.blend=function(C,T){if(v=(255&T)/255,v===1)return T;const A=T>>24&255,M=T>>16&255,L=T>>8&255,B=C>>24&255,q=C>>16&255,F=C>>8&255;return d=B+Math.round((A-B)*v),m=q+Math.round((M-q)*v),y=F+Math.round((L-F)*v),S.toRgba(d,m,y)},_.ensureContrastRatio=function(C,T,A){const M=x.relativeLuminance(C>>8),L=x.relativeLuminance(T>>8);if(p(M,L)<A){if(L<M){const F=k(C,T,A),J=p(M,x.relativeLuminance(F>>8));if(J<A){const te=j(C,T,A);return J>p(M,x.relativeLuminance(te>>8))?F:te}return F}const B=j(C,T,A),q=p(M,x.relativeLuminance(B>>8));if(q<A){const F=k(C,T,A);return q>p(M,x.relativeLuminance(F>>8))?B:F}return B}},_.reduceLuminance=k,_.increaseLuminance=j,_.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),j=d(5435),C=d(5981),T=d(2660);let A=!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(T.OscLinkService),this._instantiationService.setService(y.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new j.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,F)=>this._inputHandler.parse(q,F)))),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&&!A&&(this._logService.warn("writeSync is unreliable and will be removed soon."),A=!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,F){this._bufferService.scrollLines(B,q,F)}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(ee,H,$,O){var P,z=arguments.length,I=z<3?H:O===null?O=Object.getOwnPropertyDescriptor(H,$):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(ee,H,$,O);else for(var G=ee.length-1;G>=0;G--)(P=ee[G])&&(I=(z<3?P(I):z>3?P(H,$,I):P(H,$))||I);return z>3&&I&&Object.defineProperty(H,$,I),I},y=this&&this.__param||function(ee,H){return function($,O){H($,O,ee)}};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),j=d(2585),C=d(1480),T=d(6242),A=d(6351),M=d(5941),L={"(":0,")":1,"*":2,"+":3,"-":1,".":2},B=131072;function q(ee,H){if(ee>24)return H.setWinLines||!1;switch(ee){case 1:return!!H.restoreWin;case 2:return!!H.minimizeWin;case 3:return!!H.setWinPosition;case 4:return!!H.setWinSizePixels;case 5:return!!H.raiseWin;case 6:return!!H.lowerWin;case 7:return!!H.refreshWin;case 8:return!!H.setWinSizeChars;case 9:return!!H.maximizeWin;case 10:return!!H.fullscreenWin;case 11:return!!H.getWinState;case 13:return!!H.getWinPosition;case 14:return!!H.getWinSizePixels;case 15:return!!H.getScreenSizePixels;case 16:return!!H.getCellSizePixels;case 18:return!!H.getWinSizeChars;case 19:return!!H.getScreenSizeChars;case 20:return!!H.getIconTitle;case 21:return!!H.getWinTitle;case 22:return!!H.pushTitle;case 23:return!!H.popTitle;case 24:return!!H.setWinLines}return!1}var F;(function(ee){ee[ee.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",ee[ee.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(F||(l.WindowsOptionsReportType=F={}));let J=0;class te extends R.Disposable{getAttrData(){return this._curAttrData}constructor(H,$,O,P,z,I,G,ie,X=new w.EscapeSequenceParser){super(),this._bufferService=H,this._charsetService=$,this._coreService=O,this._logService=P,this._optionsService=z,this._oscLinkService=I,this._coreMouseService=G,this._unicodeService=ie,this._parser=X,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((V=>this._activeBuffer=V.activeBuffer))),this._parser.setCsiHandlerFallback(((V,ce)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(V),params:ce.toArray()})})),this._parser.setEscHandlerFallback((V=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(V)})})),this._parser.setExecuteHandlerFallback((V=>{this._logService.debug("Unknown EXECUTE code: ",{code:V})})),this._parser.setOscHandlerFallback(((V,ce,ae)=>{this._logService.debug("Unknown OSC code: ",{identifier:V,action:ce,data:ae})})),this._parser.setDcsHandlerFallback(((V,ce,ae)=>{ce==="HOOK"&&(ae=ae.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(V),action:ce,payload:ae})})),this._parser.setPrintHandler(((V,ce,ae)=>this.print(V,ce,ae))),this._parser.registerCsiHandler({final:"@"},(V=>this.insertChars(V))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(V=>this.scrollLeft(V))),this._parser.registerCsiHandler({final:"A"},(V=>this.cursorUp(V))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(V=>this.scrollRight(V))),this._parser.registerCsiHandler({final:"B"},(V=>this.cursorDown(V))),this._parser.registerCsiHandler({final:"C"},(V=>this.cursorForward(V))),this._parser.registerCsiHandler({final:"D"},(V=>this.cursorBackward(V))),this._parser.registerCsiHandler({final:"E"},(V=>this.cursorNextLine(V))),this._parser.registerCsiHandler({final:"F"},(V=>this.cursorPrecedingLine(V))),this._parser.registerCsiHandler({final:"G"},(V=>this.cursorCharAbsolute(V))),this._parser.registerCsiHandler({final:"H"},(V=>this.cursorPosition(V))),this._parser.registerCsiHandler({final:"I"},(V=>this.cursorForwardTab(V))),this._parser.registerCsiHandler({final:"J"},(V=>this.eraseInDisplay(V,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(V=>this.eraseInDisplay(V,!0))),this._parser.registerCsiHandler({final:"K"},(V=>this.eraseInLine(V,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(V=>this.eraseInLine(V,!0))),this._parser.registerCsiHandler({final:"L"},(V=>this.insertLines(V))),this._parser.registerCsiHandler({final:"M"},(V=>this.deleteLines(V))),this._parser.registerCsiHandler({final:"P"},(V=>this.deleteChars(V))),this._parser.registerCsiHandler({final:"S"},(V=>this.scrollUp(V))),this._parser.registerCsiHandler({final:"T"},(V=>this.scrollDown(V))),this._parser.registerCsiHandler({final:"X"},(V=>this.eraseChars(V))),this._parser.registerCsiHandler({final:"Z"},(V=>this.cursorBackwardTab(V))),this._parser.registerCsiHandler({final:"`"},(V=>this.charPosAbsolute(V))),this._parser.registerCsiHandler({final:"a"},(V=>this.hPositionRelative(V))),this._parser.registerCsiHandler({final:"b"},(V=>this.repeatPrecedingCharacter(V))),this._parser.registerCsiHandler({final:"c"},(V=>this.sendDeviceAttributesPrimary(V))),this._parser.registerCsiHandler({prefix:">",final:"c"},(V=>this.sendDeviceAttributesSecondary(V))),this._parser.registerCsiHandler({final:"d"},(V=>this.linePosAbsolute(V))),this._parser.registerCsiHandler({final:"e"},(V=>this.vPositionRelative(V))),this._parser.registerCsiHandler({final:"f"},(V=>this.hVPosition(V))),this._parser.registerCsiHandler({final:"g"},(V=>this.tabClear(V))),this._parser.registerCsiHandler({final:"h"},(V=>this.setMode(V))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(V=>this.setModePrivate(V))),this._parser.registerCsiHandler({final:"l"},(V=>this.resetMode(V))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(V=>this.resetModePrivate(V))),this._parser.registerCsiHandler({final:"m"},(V=>this.charAttributes(V))),this._parser.registerCsiHandler({final:"n"},(V=>this.deviceStatus(V))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(V=>this.deviceStatusPrivate(V))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(V=>this.softReset(V))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(V=>this.setCursorStyle(V))),this._parser.registerCsiHandler({final:"r"},(V=>this.setScrollRegion(V))),this._parser.registerCsiHandler({final:"s"},(V=>this.saveCursor(V))),this._parser.registerCsiHandler({final:"t"},(V=>this.windowOptions(V))),this._parser.registerCsiHandler({final:"u"},(V=>this.restoreCursor(V))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(V=>this.insertColumns(V))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(V=>this.deleteColumns(V))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(V=>this.selectProtected(V))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(V=>this.requestMode(V,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(V=>this.requestMode(V,!1))),this._parser.setExecuteHandler(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 T.OscHandler((V=>(this.setTitle(V),this.setIconName(V),!0)))),this._parser.registerOscHandler(1,new T.OscHandler((V=>this.setIconName(V)))),this._parser.registerOscHandler(2,new T.OscHandler((V=>this.setTitle(V)))),this._parser.registerOscHandler(4,new T.OscHandler((V=>this.setOrReportIndexedColor(V)))),this._parser.registerOscHandler(8,new T.OscHandler((V=>this.setHyperlink(V)))),this._parser.registerOscHandler(10,new T.OscHandler((V=>this.setOrReportFgColor(V)))),this._parser.registerOscHandler(11,new T.OscHandler((V=>this.setOrReportBgColor(V)))),this._parser.registerOscHandler(12,new T.OscHandler((V=>this.setOrReportCursorColor(V)))),this._parser.registerOscHandler(104,new T.OscHandler((V=>this.restoreIndexedColor(V)))),this._parser.registerOscHandler(110,new T.OscHandler((V=>this.restoreFgColor(V)))),this._parser.registerOscHandler(111,new T.OscHandler((V=>this.restoreBgColor(V)))),this._parser.registerOscHandler(112,new T.OscHandler((V=>this.restoreCursorColor(V)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const V in S.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:V},(()=>this.selectCharset("("+V))),this._parser.registerEscHandler({intermediates:")",final:V},(()=>this.selectCharset(")"+V))),this._parser.registerEscHandler({intermediates:"*",final:V},(()=>this.selectCharset("*"+V))),this._parser.registerEscHandler({intermediates:"+",final:V},(()=>this.selectCharset("+"+V))),this._parser.registerEscHandler({intermediates:"-",final:V},(()=>this.selectCharset("-"+V))),this._parser.registerEscHandler({intermediates:".",final:V},(()=>this.selectCharset("."+V))),this._parser.registerEscHandler({intermediates:"/",final:V},(()=>this.selectCharset("/"+V)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((V=>(this._logService.error("Parsing error: ",V),V))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new A.DcsHandler(((V,ce)=>this.requestStatusString(V,ce))))}_preserveStack(H,$,O,P){this._parseStack.paused=!0,this._parseStack.cursorStartX=H,this._parseStack.cursorStartY=$,this._parseStack.decodedLength=O,this._parseStack.position=P}_logSlowResolvingAsync(H){this._logService.logLevel<=j.LogLevelEnum.WARN&&Promise.race([H,new Promise((($,O)=>setTimeout((()=>O("#SLOW_TIMEOUT")),5e3)))]).catch(($=>{if($!=="#SLOW_TIMEOUT")throw $;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(H,$){let O,P=this._activeBuffer.x,z=this._activeBuffer.y,I=0;const G=this._parseStack.paused;if(G){if(O=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,$))return this._logSlowResolvingAsync(O),O;P=this._parseStack.cursorStartX,z=this._parseStack.cursorStartY,this._parseStack.paused=!1,H.length>B&&(I=this._parseStack.position+B)}if(this._logService.logLevel<=j.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof H=="string"?` "${H}"`:` "${Array.prototype.map.call(H,(V=>String.fromCharCode(V))).join("")}"`),typeof H=="string"?H.split("").map((V=>V.charCodeAt(0))):H),this._parseBuffer.length<H.length&&this._parseBuffer.length<B&&(this._parseBuffer=new Uint32Array(Math.min(H.length,B))),G||this._dirtyRowTracker.clearRange(),H.length>B)for(let V=I;V<H.length;V+=B){const ce=V+B<H.length?V+B:H.length,ae=typeof H=="string"?this._stringDecoder.decode(H.substring(V,ce),this._parseBuffer):this._utf8Decoder.decode(H.subarray(V,ce),this._parseBuffer);if(O=this._parser.parse(this._parseBuffer,ae))return this._preserveStack(P,z,ae,V),this._logSlowResolvingAsync(O),O}else if(!G){const V=typeof H=="string"?this._stringDecoder.decode(H,this._parseBuffer):this._utf8Decoder.decode(H,this._parseBuffer);if(O=this._parser.parse(this._parseBuffer,V))return this._preserveStack(P,z,V,0),this._logSlowResolvingAsync(O),O}this._activeBuffer.x===P&&this._activeBuffer.y===z||this._onCursorMove.fire();const ie=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),X=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);X<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(X,this._bufferService.rows-1),Math.min(ie,this._bufferService.rows-1))}print(H,$,O){let P,z;const I=this._charsetService.charset,G=this._optionsService.rawOptions.screenReaderMode,ie=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,V=this._coreService.modes.insertMode,ce=this._curAttrData;let ae=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&O-$>0&&ae.getWidth(this._activeBuffer.x-1)===2&&ae.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ce);let Y=this._parser.precedingJoinState;for(let Z=$;Z<O;++Z){if(P=H[Z],P<127&&I){const Ie=I[String.fromCharCode(P)];Ie&&(P=Ie.charCodeAt(0))}const ue=this._unicodeService.charProperties(P,Y);z=C.UnicodeService.extractWidth(ue);const we=C.UnicodeService.extractShouldJoin(ue),Ae=we?C.UnicodeService.extractWidth(Y):0;if(Y=ue,G&&this._onA11yChar.fire((0,x.stringFromCodePoint)(P)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+z-Ae>ie){if(X){const Ie=ae;let $e=this._activeBuffer.x-Ae;for(this._activeBuffer.x=Ae,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),Ae>0&&ae instanceof g.BufferLine&&ae.copyCellsFrom(Ie,$e,0,Ae,!1);$e<ie;)Ie.setCellFromCodepoint($e++,0,1,ce)}else if(this._activeBuffer.x=ie-1,z===2)continue}if(we&&this._activeBuffer.x){const Ie=ae.getWidth(this._activeBuffer.x-1)?1:2;ae.addCodepointToCell(this._activeBuffer.x-Ie,P,z);for(let $e=z-Ae;--$e>=0;)ae.setCellFromCodepoint(this._activeBuffer.x++,0,0,ce)}else if(V&&(ae.insertCells(this._activeBuffer.x,z-Ae,this._activeBuffer.getNullCell(ce)),ae.getWidth(ie-1)===2&&ae.setCellFromCodepoint(ie-1,p.NULL_CELL_CODE,p.NULL_CELL_WIDTH,ce)),ae.setCellFromCodepoint(this._activeBuffer.x++,P,z,ce),z>0)for(;--z;)ae.setCellFromCodepoint(this._activeBuffer.x++,0,0,ce)}this._parser.precedingJoinState=Y,this._activeBuffer.x<ie&&O-$>0&&ae.getWidth(this._activeBuffer.x)===0&&!ae.hasContent(this._activeBuffer.x)&&ae.setCellFromCodepoint(this._activeBuffer.x,0,1,ce),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(H,$){return H.final!=="t"||H.prefix||H.intermediates?this._parser.registerCsiHandler(H,$):this._parser.registerCsiHandler(H,(O=>!q(O.params[0],this._optionsService.rawOptions.windowOptions)||$(O)))}registerDcsHandler(H,$){return this._parser.registerDcsHandler(H,new A.DcsHandler($))}registerEscHandler(H,$){return this._parser.registerEscHandler(H,$)}registerOscHandler(H,$){return this._parser.registerOscHandler(H,new T.OscHandler($))}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 H;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&&((H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&H.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);$.hasWidth(this._activeBuffer.x)&&!$.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const H=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-H),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(H=this._bufferService.cols-1){this._activeBuffer.x=Math.min(H,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(H,$){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=H,this._activeBuffer.y=this._activeBuffer.scrollTop+$):(this._activeBuffer.x=H,this._activeBuffer.y=$),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(H,$){this._restrictCursor(),this._setCursor(this._activeBuffer.x+H,this._activeBuffer.y+$)}cursorUp(H){const $=this._activeBuffer.y-this._activeBuffer.scrollTop;return $>=0?this._moveCursor(0,-Math.min($,H.params[0]||1)):this._moveCursor(0,-(H.params[0]||1)),!0}cursorDown(H){const $=this._activeBuffer.scrollBottom-this._activeBuffer.y;return $>=0?this._moveCursor(0,Math.min($,H.params[0]||1)):this._moveCursor(0,H.params[0]||1),!0}cursorForward(H){return this._moveCursor(H.params[0]||1,0),!0}cursorBackward(H){return this._moveCursor(-(H.params[0]||1),0),!0}cursorNextLine(H){return this.cursorDown(H),this._activeBuffer.x=0,!0}cursorPrecedingLine(H){return this.cursorUp(H),this._activeBuffer.x=0,!0}cursorCharAbsolute(H){return this._setCursor((H.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(H){return this._setCursor(H.length>=2?(H.params[1]||1)-1:0,(H.params[0]||1)-1),!0}charPosAbsolute(H){return this._setCursor((H.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(H){return this._moveCursor(H.params[0]||1,0),!0}linePosAbsolute(H){return this._setCursor(this._activeBuffer.x,(H.params[0]||1)-1),!0}vPositionRelative(H){return this._moveCursor(0,H.params[0]||1),!0}hVPosition(H){return this.cursorPosition(H),!0}tabClear(H){const $=H.params[0];return $===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:$===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(H){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let $=H.params[0]||1;for(;$--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(H){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let $=H.params[0]||1;for(;$--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(H){const $=H.params[0];return $===1&&(this._curAttrData.bg|=536870912),$!==2&&$!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(H,$,O,P=!1,z=!1){const I=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);I.replaceCells($,O,this._activeBuffer.getNullCell(this._eraseAttrData()),z),P&&(I.isWrapped=!1)}_resetBufferLine(H,$=!1){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);O&&(O.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),$),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+H),O.isWrapped=!1)}eraseInDisplay(H,$=!1){let O;switch(this._restrictCursor(this._bufferService.cols),H.params[0]){case 0:for(O=this._activeBuffer.y,this._dirtyRowTracker.markDirty(O),this._eraseInBufferLine(O++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,$);O<this._bufferService.rows;O++)this._resetBufferLine(O,$);this._dirtyRowTracker.markDirty(O);break;case 1:for(O=this._activeBuffer.y,this._dirtyRowTracker.markDirty(O),this._eraseInBufferLine(O,0,this._activeBuffer.x+1,!0,$),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(O+1).isWrapped=!1);O--;)this._resetBufferLine(O,$);this._dirtyRowTracker.markDirty(0);break;case 2:for(O=this._bufferService.rows,this._dirtyRowTracker.markDirty(O-1);O--;)this._resetBufferLine(O,$);this._dirtyRowTracker.markDirty(0);break;case 3:const P=this._activeBuffer.lines.length-this._bufferService.rows;P>0&&(this._activeBuffer.lines.trimStart(P),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-P,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-P,0),this._onScroll.fire(0))}return!0}eraseInLine(H,$=!1){switch(this._restrictCursor(this._bufferService.cols),H.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,$);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,$);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,$)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(H){this._restrictCursor();let $=H.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const O=this._activeBuffer.ybase+this._activeBuffer.y,P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,z=this._bufferService.rows-1+this._activeBuffer.ybase-P+1;for(;$--;)this._activeBuffer.lines.splice(z-1,1),this._activeBuffer.lines.splice(O,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(H){this._restrictCursor();let $=H.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const O=this._activeBuffer.ybase+this._activeBuffer.y;let P;for(P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,P=this._bufferService.rows-1+this._activeBuffer.ybase-P;$--;)this._activeBuffer.lines.splice(O,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(H){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.insertCells(this._activeBuffer.x,H.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(H){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.deleteCells(this._activeBuffer.x,H.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(H){let $=H.params[0]||1;for(;$--;)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(H){let $=H.params[0]||1;for(;$--;)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(H){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=H.params[0]||1;for(let O=this._activeBuffer.scrollTop;O<=this._activeBuffer.scrollBottom;++O){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);P.deleteCells(0,$,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(H){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=H.params[0]||1;for(let O=this._activeBuffer.scrollTop;O<=this._activeBuffer.scrollBottom;++O){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);P.insertCells(0,$,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(H){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=H.params[0]||1;for(let O=this._activeBuffer.scrollTop;O<=this._activeBuffer.scrollBottom;++O){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);P.insertCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(H){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=H.params[0]||1;for(let O=this._activeBuffer.scrollTop;O<=this._activeBuffer.scrollBottom;++O){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);P.deleteCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(H){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(H.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(H){const $=this._parser.precedingJoinState;if(!$)return!0;const O=H.params[0]||1,P=C.UnicodeService.extractWidth($),z=this._activeBuffer.x-P,I=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(z),G=new Uint32Array(I.length*O);let ie=0;for(let V=0;V<I.length;){const ce=I.codePointAt(V)||0;G[ie++]=ce,V+=ce>65535?2:1}let X=ie;for(let V=1;V<O;++V)G.copyWithin(X,0,ie),X+=ie;return this.print(G,0,X),!0}sendDeviceAttributesPrimary(H){return H.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(H){return H.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(H.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(v.C0.ESC+"[>83;40003;0c")),!0}_is(H){return(this._optionsService.rawOptions.termName+"").indexOf(H)===0}setMode(H){for(let $=0;$<H.length;$++)switch(H.params[$]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(H){for(let $=0;$<H.length;$++)switch(H.params[$]){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(H){for(let $=0;$<H.length;$++)switch(H.params[$]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(H){for(let $=0;$<H.length;$++)switch(H.params[$]){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(),H.params[$]===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(H,$){const O=this._coreService.decPrivateModes,{activeProtocol:P,activeEncoding:z}=this._coreMouseService,I=this._coreService,{buffers:G,cols:ie}=this._bufferService,{active:X,alt:V}=G,ce=this._optionsService.rawOptions,ae=we=>we?1:2,Y=H.params[0];return Z=Y,ue=$?Y===2?4:Y===4?ae(I.modes.insertMode):Y===12?3:Y===20?ae(ce.convertEol):0:Y===1?ae(O.applicationCursorKeys):Y===3?ce.windowOptions.setWinLines?ie===80?2:ie===132?1:0:0:Y===6?ae(O.origin):Y===7?ae(O.wraparound):Y===8?3:Y===9?ae(P==="X10"):Y===12?ae(ce.cursorBlink):Y===25?ae(!I.isCursorHidden):Y===45?ae(O.reverseWraparound):Y===66?ae(O.applicationKeypad):Y===67?4:Y===1e3?ae(P==="VT200"):Y===1002?ae(P==="DRAG"):Y===1003?ae(P==="ANY"):Y===1004?ae(O.sendFocus):Y===1005?4:Y===1006?ae(z==="SGR"):Y===1015?4:Y===1016?ae(z==="SGR_PIXELS"):Y===1048?1:Y===47||Y===1047||Y===1049?ae(X===V):Y===2004?ae(O.bracketedPasteMode):0,I.triggerDataEvent(`${v.C0.ESC}[${$?"":"?"}${Z};${ue}$y`),!0;var Z,ue}_updateAttrColor(H,$,O,P,z){return $===2?(H|=50331648,H&=-16777216,H|=k.AttributeData.fromColorRGB([O,P,z])):$===5&&(H&=-50331904,H|=33554432|255&O),H}_extractColor(H,$,O){const P=[0,0,-1,0,0,0];let z=0,I=0;do{if(P[I+z]=H.params[$+I],H.hasSubParams($+I)){const G=H.getSubParams($+I);let ie=0;do P[1]===5&&(z=1),P[I+ie+1+z]=G[ie];while(++ie<G.length&&ie+I+1+z<P.length);break}if(P[1]===5&&I+z>=2||P[1]===2&&I+z>=5)break;P[1]&&(z=1)}while(++I+$<H.length&&I+z<P.length);for(let G=2;G<P.length;++G)P[G]===-1&&(P[G]=0);switch(P[0]){case 38:O.fg=this._updateAttrColor(O.fg,P[1],P[3],P[4],P[5]);break;case 48:O.bg=this._updateAttrColor(O.bg,P[1],P[3],P[4],P[5]);break;case 58:O.extended=O.extended.clone(),O.extended.underlineColor=this._updateAttrColor(O.extended.underlineColor,P[1],P[3],P[4],P[5])}return I}_processUnderline(H,$){$.extended=$.extended.clone(),(!~H||H>5)&&(H=1),$.extended.underlineStyle=H,$.fg|=268435456,H===0&&($.fg&=-268435457),$.updateExtended()}_processSGR0(H){H.fg=g.DEFAULT_ATTR_DATA.fg,H.bg=g.DEFAULT_ATTR_DATA.bg,H.extended=H.extended.clone(),H.extended.underlineStyle=0,H.extended.underlineColor&=-67108864,H.updateExtended()}charAttributes(H){if(H.length===1&&H.params[0]===0)return this._processSGR0(this._curAttrData),!0;const $=H.length;let O;const P=this._curAttrData;for(let z=0;z<$;z++)O=H.params[z],O>=30&&O<=37?(P.fg&=-50331904,P.fg|=16777216|O-30):O>=40&&O<=47?(P.bg&=-50331904,P.bg|=16777216|O-40):O>=90&&O<=97?(P.fg&=-50331904,P.fg|=16777224|O-90):O>=100&&O<=107?(P.bg&=-50331904,P.bg|=16777224|O-100):O===0?this._processSGR0(P):O===1?P.fg|=134217728:O===3?P.bg|=67108864:O===4?(P.fg|=268435456,this._processUnderline(H.hasSubParams(z)?H.getSubParams(z)[0]:1,P)):O===5?P.fg|=536870912:O===7?P.fg|=67108864:O===8?P.fg|=1073741824:O===9?P.fg|=2147483648:O===2?P.bg|=134217728:O===21?this._processUnderline(2,P):O===22?(P.fg&=-134217729,P.bg&=-134217729):O===23?P.bg&=-67108865:O===24?(P.fg&=-268435457,this._processUnderline(0,P)):O===25?P.fg&=-536870913:O===27?P.fg&=-67108865:O===28?P.fg&=-1073741825:O===29?P.fg&=2147483647:O===39?(P.fg&=-67108864,P.fg|=16777215&g.DEFAULT_ATTR_DATA.fg):O===49?(P.bg&=-67108864,P.bg|=16777215&g.DEFAULT_ATTR_DATA.bg):O===38||O===48||O===58?z+=this._extractColor(H,z,P):O===53?P.bg|=1073741824:O===55?P.bg&=-1073741825:O===59?(P.extended=P.extended.clone(),P.extended.underlineColor=-1,P.updateExtended()):O===100?(P.fg&=-67108864,P.fg|=16777215&g.DEFAULT_ATTR_DATA.fg,P.bg&=-67108864,P.bg|=16777215&g.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",O);return!0}deviceStatus(H){switch(H.params[0]){case 5:this._coreService.triggerDataEvent(`${v.C0.ESC}[0n`);break;case 6:const $=this._activeBuffer.y+1,O=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${v.C0.ESC}[${$};${O}R`)}return!0}deviceStatusPrivate(H){if(H.params[0]===6){const $=this._activeBuffer.y+1,O=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${v.C0.ESC}[?${$};${O}R`)}return!0}softReset(H){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(H){const $=H.params[0]||1;switch($){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 O=$%2==1;return this._optionsService.options.cursorBlink=O,!0}setScrollRegion(H){const $=H.params[0]||1;let O;return(H.length<2||(O=H.params[1])>this._bufferService.rows||O===0)&&(O=this._bufferService.rows),O>$&&(this._activeBuffer.scrollTop=$-1,this._activeBuffer.scrollBottom=O-1,this._setCursor(0,0)),!0}windowOptions(H){if(!q(H.params[0],this._optionsService.rawOptions.windowOptions))return!0;const $=H.length>1?H.params[1]:0;switch(H.params[0]){case 14:$!==2&&this._onRequestWindowsOptionsReport.fire(F.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(F.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${v.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:$!==0&&$!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),$!==0&&$!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:$!==0&&$!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),$!==0&&$!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(H){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(H){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(H){return this._windowTitle=H,this._onTitleChange.fire(H),!0}setIconName(H){return this._iconName=H,!0}setOrReportIndexedColor(H){const $=[],O=H.split(";");for(;O.length>1;){const P=O.shift(),z=O.shift();if(/^\d+$/.exec(P)){const I=parseInt(P);if(se(I))if(z==="?")$.push({type:0,index:I});else{const G=(0,M.parseColor)(z);G&&$.push({type:1,index:I,color:G})}}}return $.length&&this._onColor.fire($),!0}setHyperlink(H){const $=H.split(";");return!($.length<2)&&($[1]?this._createHyperlink($[0],$[1]):!$[0]&&this._finishHyperlink())}_createHyperlink(H,$){this._getCurrentLinkId()&&this._finishHyperlink();const O=H.split(":");let P;const z=O.findIndex((I=>I.startsWith("id=")));return z!==-1&&(P=O[z].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:P,uri:$}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(H,$){const O=H.split(";");for(let P=0;P<O.length&&!($>=this._specialColors.length);++P,++$)if(O[P]==="?")this._onColor.fire([{type:0,index:this._specialColors[$]}]);else{const z=(0,M.parseColor)(O[P]);z&&this._onColor.fire([{type:1,index:this._specialColors[$],color:z}])}return!0}setOrReportFgColor(H){return this._setOrReportSpecialColor(H,0)}setOrReportBgColor(H){return this._setOrReportSpecialColor(H,1)}setOrReportCursorColor(H){return this._setOrReportSpecialColor(H,2)}restoreIndexedColor(H){if(!H)return this._onColor.fire([{type:2}]),!0;const $=[],O=H.split(";");for(let P=0;P<O.length;++P)if(/^\d+$/.exec(O[P])){const z=parseInt(O[P]);se(z)&&$.push({type:2,index:z})}return $.length&&this._onColor.fire($),!0}restoreFgColor(H){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(H){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(H){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(H){return H.length!==2?(this.selectDefaultCharset(),!0):(H[0]==="/"||this._charsetService.setgCharset(L[H[0]],S.CHARSETS[H[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 H=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,H,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(H){return this._charsetService.setgLevel(H),!0}screenAlignmentPattern(){const H=new _.CellData;H.content=4194373,H.fg=this._curAttrData.fg,H.bg=this._curAttrData.bg,this._setCursor(0,0);for(let $=0;$<this._bufferService.rows;++$){const O=this._activeBuffer.ybase+this._activeBuffer.y+$,P=this._activeBuffer.lines.get(O);P&&(P.fill(H),P.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(H,$){const O=this._bufferService.buffer,P=this._optionsService.rawOptions;return(z=>(this._coreService.triggerDataEvent(`${v.C0.ESC}${z}${v.C0.ESC}\\`),!0))(H==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:H==='"p'?'P1$r61;1"p':H==="r"?`P1$r${O.scrollTop+1};${O.scrollBottom+1}r`:H==="m"?"P1$r0m":H===" q"?`P1$r${{block:2,underline:4,bar:6}[P.cursorStyle]-(P.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(H,$){this._dirtyRowTracker.markRangeDirty(H,$)}}l.InputHandler=te;let W=class{constructor(ee){this._bufferService=ee,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(ee){ee<this.start?this.start=ee:ee>this.end&&(this.end=ee)}markRangeDirty(ee,H){ee>H&&(J=ee,ee=H,H=J),ee<this.start&&(this.start=ee),H>this.end&&(this.end=H)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function se(ee){return 0<=ee&&ee<256}W=m([y(0,j.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 j=0;const C=this._getCorrectBufferLength(_);if(C>this.lines.maxLength&&(this.lines.maxLength=C),this.lines.length>0){if(this._cols<p)for(let A=0;A<this.lines.length;A++)j+=+this.lines.get(A).resize(p,k);let T=0;if(this._rows<_)for(let A=this._rows;A<_;A++)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+T+1?(this.ybase--,T++,this.ydisp>0&&this.ydisp--):this.lines.push(new S.BufferLine(p,k)));else for(let A=this._rows;A>_;A--)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 A=this.lines.length-C;A>0&&(this.lines.trimStart(A),this.ybase=Math.max(this.ybase-A,0),this.ydisp=Math.max(this.ydisp-A,0),this.savedY=Math.max(this.savedY-A,0)),this.lines.maxLength=C}this.x=Math.min(this.x,p-1),this.y=Math.min(this.y,_-1),T&&(this.y+=T),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 T=0;T<this.lines.length;T++)j+=+this.lines.get(T).resize(p,k);this._cols=p,this._rows=_,this._memoryCleanupQueue.clear(),j>.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 j=(0,w.reflowLargerCreateNewLayout)(this.lines,k);(0,w.reflowLargerApplyNewLayout)(this.lines,j.layout),this._reflowLargerAdjustViewport(p,_,j.countRemoved)}}_reflowLargerAdjustViewport(p,_,k){const j=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,j))):(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),j=[];let C=0;for(let T=this.lines.length-1;T>=0;T--){let A=this.lines.get(T);if(!A||!A.isWrapped&&A.getTrimmedLength()<=p)continue;const M=[A];for(;A.isWrapped&&T>0;)A=this.lines.get(--T),M.unshift(A);const L=this.ybase+this.y;if(L>=T&&L<T+M.length)continue;const B=M[M.length-1].getTrimmedLength(),q=(0,w.reflowSmallerGetNewLineLengths)(M,this._cols,p),F=q.length-M.length;let J;J=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+F):Math.max(0,this.lines.length-this.lines.maxLength+F);const te=[];for(let O=0;O<F;O++){const P=this.getBlankLine(S.DEFAULT_ATTR_DATA,!0);te.push(P)}te.length>0&&(j.push({start:T+M.length+C,newLines:te}),C+=te.length),M.push(...te);let W=q.length-1,se=q[W];se===0&&(W--,se=q[W]);let ee=M.length-F-1,H=B;for(;ee>=0;){const O=Math.min(H,se);if(M[W]===void 0)break;if(M[W].copyCellsFrom(M[ee],H-O,se-O,O,!0),se-=O,se===0&&(W--,se=q[W]),H-=O,H===0){ee--;const P=Math.max(ee,0);H=(0,w.getWrappedLineTrimmedLength)(M,P,this._cols)}}for(let O=0;O<M.length;O++)q[O]<p&&M[O].setCell(q[O],k);let $=F-J;for(;$-- >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+F,this.ybase+_-1)}if(j.length>0){const T=[],A=[];for(let W=0;W<this.lines.length;W++)A.push(this.lines.get(W));const M=this.lines.length;let L=M-1,B=0,q=j[B];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+C);let F=0;for(let W=Math.min(this.lines.maxLength-1,M+C-1);W>=0;W--)if(q&&q.start>L+F){for(let se=q.newLines.length-1;se>=0;se--)this.lines.set(W--,q.newLines[se]);W++,T.push({index:L+1,amount:q.newLines.length}),F+=q.newLines.length,q=j[++B]}else this.lines.set(W,A[L--]);let J=0;for(let W=T.length-1;W>=0;W--)T[W].index+=J,this.lines.onInsertEmitter.fire(T[W]),J+=T[W].amount;const te=Math.max(0,M+C-this.lines.maxLength);te>0&&this.lines.onTrimEmitter.fire(te)}}translateBufferLineToString(p,_,k=0,j){const C=this.lines.get(p);return C?C.translateToString(_,k,j):""}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 j=0;j<_.length;j++){const C=parseInt(_[j],10);C>=g&&delete this._combined[C]}const k=Object.keys(this._extendedAttrs);for(let j=0;j<k.length;j++){const C=parseInt(k[j],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 j=g._data;if(k)for(let T=_-1;T>=0;T--){for(let A=0;A<3;A++)this._data[3*(p+T)+A]=j[3*(b+T)+A];268435456&j[3*(b+T)+2]&&(this._extendedAttrs[p+T]=g._extendedAttrs[b+T])}else for(let T=0;T<_;T++){for(let A=0;A<3;A++)this._data[3*(p+T)+A]=j[3*(b+T)+A];268435456&j[3*(b+T)+2]&&(this._extendedAttrs[p+T]=g._extendedAttrs[b+T])}const C=Object.keys(g._combined);for(let T=0;T<C.length;T++){const A=parseInt(C[T],10);A>=b&&(this._combined[A-b+p]=g._combined[A])}}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 j=this._data[3*b+0],C=2097151&j,T=2097152&j?this._combined[b]:C?(0,S.stringFromCodePoint)(C):v.WHITESPACE_CELL_CHAR;if(k+=T,_)for(let A=0;A<T.length;++A)_.push(b);b+=j>>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),j=1,C=0;for(;j<p.length;){const A=d(p,j,y),M=A-C,L=v-k,B=Math.min(M,L);p[_].copyCellsFrom(p[j],C,k,B,!1),k+=B,k===v&&(_++,k=0),C+=B,C===A&&(j++,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 T=0;for(let A=p.length-1;A>0&&(A>_||p[A].getTrimmedLength()===0);A--)T++;T>0&&(R.push(x+p.length-T),R.push(T)),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,j=this.interim[0];j&=(224&j)==192?31:(240&j)==224?15:7;let C,T=0;for(;(C=63&this.interim[++T])&&T<4;)j<<=6,j|=C;const A=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,M=A-T;for(;b<M;){if(b>=y)return 0;if(C=d[b++],(192&C)!=128){b--,k=!0;break}this.interim[T++]=C,j<<=6,j|=63&C}k||(A===2?j<128?b--:m[x++]=j:A===3?j<2048||j>=55296&&j<=57343||j===65279||(m[x++]=j):j<65536||j>1114111||(m[x++]=j)),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 j=0;j<b.length;j++)this.table[p<<8|b[j]]=_<<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(((T,A)=>A)),p=(T,A)=>b.slice(T,A),_=p(32,127),k=p(0,24);k.push(25),k.push.apply(k,p(28,32));const j=p(0,14);let C;for(C in g.setDefault(1,0),g.addMany(_,0,2,0),j)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 j=0;j<b.intermediates.length;++j){const C=b.intermediates.charCodeAt(j);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 j=k.indexOf(p);j!==-1&&k.splice(j,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 j=k.indexOf(p);j!==-1&&k.splice(j,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,j){this._parseStack.state=b,this._parseStack.handlers=p,this._parseStack.handlerPos=_,this._parseStack.transition=k,this._parseStack.chunkPos=j}parse(b,p,_){let k,j=0,C=0,T=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,T=this._parseStack.chunkPos+1;else{if(_===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const A=this._parseStack.handlers;let M=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(_===!1&&M>-1){for(;M>=0&&(k=A[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=A[M](),k!==!0);M--)if(k instanceof Promise)return this._parseStack.handlerPos=M,k}this._parseStack.handlers=[];break;case 6:if(j=b[this._parseStack.chunkPos],k=this._dcsParser.unhook(j!==24&&j!==26,_),k)return k;j===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(j=b[this._parseStack.chunkPos],k=this._oscParser.end(j!==24&&j!==26,_),k)return k;j===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,T=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let A=T;A<p;++A){switch(j=b[A],C=this._transitions.table[this.currentState<<8|(j<160?j:R)],C>>4){case 2:for(let F=A+1;;++F){if(F>=p||(j=b[F])<32||j>126&&j<R){this._printHandler(b,A,F),A=F-1;break}if(++F>=p||(j=b[F])<32||j>126&&j<R){this._printHandler(b,A,F),A=F-1;break}if(++F>=p||(j=b[F])<32||j>126&&j<R){this._printHandler(b,A,F),A=F-1;break}if(++F>=p||(j=b[F])<32||j>126&&j<R){this._printHandler(b,A,F),A=F-1;break}}break;case 3:this._executeHandlers[j]?this._executeHandlers[j]():this._executeHandlerFb(j),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:A,code:j,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const M=this._csiHandlers[this._collect<<8|j];let L=M?M.length-1:-1;for(;L>=0&&(k=M[L](this._params),k!==!0);L--)if(k instanceof Promise)return this._preserveStack(3,M,L,C,A),k;L<0&&this._csiHandlerFb(this._collect<<8|j,this._params),this.precedingJoinState=0;break;case 8:do switch(j){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(j-48)}while(++A<p&&(j=b[A])>47&&j<60);A--;break;case 9:this._collect<<=8,this._collect|=j;break;case 10:const B=this._escHandlers[this._collect<<8|j];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,A),k;q<0&&this._escHandlerFb(this._collect<<8|j),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|j,this._params);break;case 13:for(let F=A+1;;++F)if(F>=p||(j=b[F])===24||j===26||j===27||j>127&&j<R){this._dcsParser.put(b,A,F),A=F-1;break}break;case 14:if(k=this._dcsParser.unhook(j!==24&&j!==26),k)return this._preserveStack(6,[],0,C,A),k;j===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 F=A+1;;F++)if(F>=p||(j=b[F])<32||j>127&&j<R){this._oscParser.put(b,A,F),A=F-1;break}break;case 6:if(k=this._oscParser.end(j!==24&&j!==26),k)return this._preserveStack(5,[],0,C,A),k;j===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,j=arguments.length,C=j<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,p):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(g,b,p,_);else for(var T=g.length-1;T>=0;T--)(k=g[T])&&(C=(j<3?k(C):j>3?k(b,p,C):k(b,p))||C);return j>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,j=p.ybase+p.scrollBottom;if(p.scrollTop===0){const C=p.lines.isFull;j===p.lines.length-1?C?p.lines.recycle().copyFrom(_):p.lines.push(_.clone()):p.lines.splice(j+1,0,_.clone()),C?this.isUserScrolling&&(p.ydisp=Math.max(p.ydisp-1,0)):(p.ybase++,this.isUserScrolling||p.ydisp++)}else{const C=j-k+1;p.lines.shiftElements(k+1,C-1,-1),p.lines.set(j,_.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,j,C){var T,A=arguments.length,M=A<3?k:C===null?C=Object.getOwnPropertyDescriptor(k,j):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(_,k,j,C);else for(var L=_.length-1;L>=0;L--)(T=_[L])&&(M=(A<3?T(M):A>3?T(k,j,M):T(k,j))||M);return A>3&&M&&Object.defineProperty(k,j,M),M},y=this&&this.__param||function(_,k){return function(j,C){k(j,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 j=(_.ctrl?16:0)|(_.shift?4:0)|(_.alt?8:0);return _.button===4?(j|=64,j|=_.action):(j|=3&_.button,4&_.button&&(j|=64),8&_.button&&(j|=128),_.action===32?j|=32:_.action!==0||k||(j|=3)),j}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 j of Object.keys(R))this.addProtocol(j,R[j]);for(const j of Object.keys(b))this.addEncoding(j,b[j]);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,j){if(j){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,j){var C,T=arguments.length,A=T<3?_:j===null?j=Object.getOwnPropertyDescriptor(_,k):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(p,_,k,j);else for(var M=p.length-1;M>=0;M--)(C=p[M])&&(A=(T<3?C(A):T>3?C(_,k,A):C(_,k))||A);return T>3&&A&&Object.defineProperty(_,k,A),A},y=this&&this.__param||function(p,_){return function(k,j){_(k,j,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((j=>j.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 j=0,C=0;for(const T of this._decorations.getKeyIterator(_))j=T.options.x??0,C=j+(T.options.width??1),p>=j&&p<C&&(!k||(T.options.layer??"bottom")===k)&&(yield T)}forEachDecorationAtCell(p,_,k,j){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)&&j(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,j=arguments.length,C=j<3?b:_===null?_=Object.getOwnPropertyDescriptor(b,p):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(g,b,p,_);else for(var T=g.length-1;T>=0;T--)(k=g[T])&&(C=(j<3?k(C):j>3?k(b,p,C):k(b,p))||C);return j>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 j=_.apply(this,k);return R.trace(`GlyphRenderer#${_.name} return`,j),j}}},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),j={data:w,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(j,k))),this._dataByLinkId.set(j.id,j),j.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 j=w.charCodeAt(b);56320<=j&&j<=57343?p=1024*(p-55296)+j-56320+65536:R+=this.wcwidth(j)}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 n[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,j)=>{this._checkReadonlyOptions(k),this._core.options[k]=j};for(const k in this._core.options){const j={get:p.bind(this,k),set:_.bind(this,k)};Object.defineProperty(this._publicOptions,k,j)}}_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})()))})(Nm)),Nm.exports}var HD=BD(),Mm={exports:{}},kw;function zD(){return kw||(kw=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={};return(()=>{var r=n;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(o){this._terminal=o}dispose(){}fit(){const o=this.proposeDimensions();if(!o||!this._terminal||isNaN(o.cols)||isNaN(o.rows))return;const c=this._terminal._core;this._terminal.rows===o.rows&&this._terminal.cols===o.cols||(c._renderService.clear(),this._terminal.resize(o.cols,o.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const o=this._terminal._core,c=o._renderService.dimensions;if(c.css.cell.width===0||c.css.cell.height===0)return;const 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))}}}})(),n})()))})(Mm)),Mm.exports}var UD=zD(),Om={exports:{}},jw;function qD(){return jw||(jw=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={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 j=_[0];if(!d(j))continue;const[C,T]=m._mapStrIdx(w,b,0,_.index),[A,M]=m._mapStrIdx(w,C,T,j.length);if(C===-1||T===-1||A===-1||M===-1)continue;const L={start:{x:T+1,y:C+1},end:{x:M,y:A+1}};k.push({range:L,text:j,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 j=x.getLine(S+1);j&&j.isWrapped&&(j.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 n[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})()))})(Om)),Om.exports}var FD=qD();const VD=/^[A-Za-z0-9_\-./~:\\]+$/,WD=/^[A-Za-z]:[\\/]/;function GD(e){return VD.test(e)?e:WD.test(e)?`"${e}"`:`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function KD(e){const t=e.filter(n=>n.length>0);return t.length===0?null:t.map(GD).join(" ")+" "}function YD(e,t){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal?session=${encodeURIComponent(e)}&token=${encodeURIComponent(t)}`}const XD=15e3,JD=new Set([4001,4004]),ZD='"Geist Mono", ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace';function zd(e,t){return typeof document>"u"?t:getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t}const QD={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"},e$={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 Aw(e){const t=zd("--bg",e==="dark"?"#0b0e13":"#f8f9fa"),n=zd("--ink",e==="dark"?"#f3f3f5":"#16161a"),r=zd("--brand",e==="dark"?"#6be195":"#167e3a");return{...e==="dark"?QD:e$,background:t,foreground:n,cursor:r,cursorAccent:t,selectionBackground:`${r}40`}}const t$=({sessionId:e,token:t})=>{const n=U.useRef(null),r=U.useRef(null),[o,c]=U.useState("connecting"),[f,l]=U.useState(null);return U.useEffect(()=>Hv(d=>{r.current&&(r.current.options.theme=Aw(d))}),[]),U.useEffect(()=>{var j;const d=n.current;if(!d)return;let m=!1,y=0,v=null,S=null;const w=new HD.Terminal({cursorBlink:!0,fontSize:13,fontFamily:zd("--mono",ZD),theme:Aw(vh()),scrollback:1e4,allowProposedApi:!0});r.current=w;const R=new UD.FitAddon;w.loadAddon(R),w.loadAddon(new FD.WebLinksAddon((C,T)=>{window.open(T,"_blank","noopener,noreferrer")})),w.parser.registerCsiHandler({prefix:">",final:"q"},()=>(w.write("\x1BP>|XTerm(370)\x1B\\"),!0)),w.parser.registerOscHandler(52,C=>{var M;const T=C.split(";");if(T.length<2)return!1;const A=T[T.length-1];try{const L=atob(A),B=Uint8Array.from(L,F=>F.charCodeAt(0)),q=new TextDecoder().decode(B);(M=navigator.clipboard)==null||M.writeText(q).catch(()=>{})}catch{}return!0}),w.open(d),R.fit(),(j=document.fonts)==null||j.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 T;(T=C.dataTransfer)!=null&&T.types.includes("Files")&&(C.preventDefault(),C.dataTransfer.dropEffect="copy")},_=C=>{var L,B;const T=(L=C.dataTransfer)==null?void 0:L.files;if(!T||T.length===0)return;C.preventDefault();const A=(B=xr())==null?void 0:B.pathForFile;if(!A)return;const M=KD(Array.from(T,q=>A(q)));M!==null&&(w.paste(M),w.focus())};d.addEventListener("dragover",p),d.addEventListener("drop",_);function k(){if(m)return;const C=new WebSocket(YD(e,t));S=C,C.onopen=()=>{y=0,c("connected"),l(null),R.fit(),g()},C.onmessage=T=>{const A=typeof T.data=="string"?T.data:new TextDecoder().decode(T.data);w.write(A)},C.onclose=T=>{if(m)return;if(JD.has(T.code)){c("error"),l(T.reason||`Connection refused (${T.code})`);return}const A=Math.min(1e3*2**y,XD);y+=1,c("connecting"),v=setTimeout(k,A)}}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",...Ft({surface:"terminal"}),children:h.jsx("div",{ref:n,className:"terminal-screen"})})},s$=8e3,i$=400,n$={info:"Info",success:"CircleCheck",error:"TriangleAlert"};function r$({message:e,tone:t="error",onDismiss:n}){const[r,o]=U.useState(!1),[c,f]=U.useState(!1),l=U.useCallback(()=>o(!0),[]);return U.useEffect(()=>{o(!1)},[e]),U.useEffect(()=>{if(r||c)return;const d=window.setTimeout(l,s$);return()=>window.clearTimeout(d)},[e,r,c,l]),U.useEffect(()=>{if(!r)return;const d=window.setTimeout(n,i$);return()=>window.clearTimeout(d)},[r,n]),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?n:void 0,children:[h.jsx("span",{className:"toast-icon","aria-hidden":"true",children:h.jsx(de,{name:n$[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 a$(){const e=U.useRef(null);return U.useEffect(()=>{const t=e.current;if(!t)return;let n=null;const r=()=>{n=null,t.dataset.show="false",t.textContent=""},o=l=>{const d=l.closest("[data-tooltip], [title], [data-tip-stash]");if(!d||d===n)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;n=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=>{n&&!n.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 o$="~/.sapiom/harness",l$={events:`${o$}/events.ndjson`},c$=["claude-code","codex"],_g=["vscode","vscode-insiders","cursor","windsurf","zed"],u$=[{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 d$(e){const t=e.filter(n=>n.id==="sapiom");return t.length===0?e:[...t,...e.filter(n=>n.id!=="sapiom")]}function yg(e){return e.mode==="embedded"&&e.installed&&c$.includes(e.id)}function h$(e){if(yg(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 f$(e,t){var n;return((n=e.find(r=>r.id===t))==null?void 0:n.label)??t}function Dm(e){return Zl(e)}async function p$(e,t,n){const r=Dm(e.trim());if(!r)return{kind:"new"};if(t)return{kind:"new"};const o=n5(r);try{const c=o?await n(o):null;if(!!(c!=null&&c.dirs.some(m=>Dm(m.path)===r&&m.hasAgentProject)))return{kind:"project"};const l=await n(r);if(Dm(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 n(o),{kind:"new"}}catch{throw new Error("Couldn't read that directory.")}throw new Error("Couldn't read that directory.")}}function bg({recentDirs:e,launchDir:t,projectRoot:n,listDir:r,onClose:o,onConnect:c,onScan:f,triggerRef:l}){const[d,m]=U.useState(n??t??e[0]??""),[y,v]=U.useState(null),[S,w]=U.useState(!0),[R,x]=U.useState(!1),[g,b]=U.useState(null),p=U.useRef(null);bo(!0,{onDismiss:o,containerRef:p,triggerRef:l}),U.useEffect(()=>{w(!0)},[d]);const _=U.useRef(d);_.current=d;const k=U.useRef(0),j=U.useCallback(F=>{const J=_.current.trim(),te=++k.current;if(!J){v(null),w(!1);return}p$(J,F.isNew,r).then(W=>{te===k.current&&(v(W),b(null))}).catch(W=>{te===k.current&&(v(null),b(W.message))}).finally(()=>{te===k.current&&w(!1)})},[r]),C=async F=>{x(!0),b(null);try{await F(),o()}catch(J){b(J.message)}finally{x(!1)}},T=d.trim(),A=(y==null?void 0:y.kind)==="project"||(y==null?void 0:y.kind)==="multi",M=()=>void C(()=>c(T)),L=()=>void C(async()=>{if(await f(T)===0)throw new Error("No agent projects found under this folder.")}),B=()=>{R||S||!y||!T||!A||(y.kind==="project"?M():y.kind==="multi"&&L())},q=F=>{F.key==="Enter"&&(F.metaKey||F.ctrlKey)&&(F.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,...Ft({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(w2,{value:d,onChange:m,onSubmit:B,recentDirs:[],listDir:r,onResolve:j})}),y&&h.jsx(m$,{outcome:y,path:T}),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(v$,{outcome:y,checking:S,busy:R,onConnect:M,onScan:L})]})]})})}function m$({outcome:e,path:t}){const n=e.kind==="project"||e.kind==="multi";return h.jsx("div",{className:"aw-result","data-tone":n?"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:n?"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 v$({outcome:e,checking:t,busy:n,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:n,children:n?"Adding…":"Add workspace"});case"multi":return h.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-add-all",onClick:o,disabled:n,children:n?"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 g$="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",_$="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",y$={"claude-code":g$,codex:_$},b$=["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 Sg({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:b$.map(r=>h.jsx("path",{d:r},r.slice(0,16)))});const n=y$[e];return n?h.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"currentColor","aria-hidden":"true",focusable:"false",children:h.jsx("path",{d:n})}):h.jsx(de,{name:"SquareTerminal",size:t})}function S$({entries:e,activeId:t,testidPrefix:n,onPick:r}){return h.jsx(h.Fragment,{children:e.map(o=>{const c=yg(o),f=o.id===t,l=h$(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":`${n}-${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(Sg,{kind:o.id,size:13}),o.label]},o.id)})})}const w$=[{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."}],x$=3;function C$(e){const t=e.getHours();return t<12?"Good morning.":t<18?"Good afternoon.":"Good evening."}function E$(e){return e.replace(/\s+/g,"-")}function k$({firstRun:e,onSubmitIdea:t,onUseTemplate:n,onBrowseTemplates:r,listHarnesses:o,listTemplates:c,telemetryOptIn:f,onToggleTelemetry:l,recentDirs:d,projectRoot:m,listDir:y,onConnect:v,onScan:S,onScaffold:w,onSaveProjectRoot:R}){const[x,g]=U.useState(""),[b,p]=U.useState(()=>dn().preferredHarness??"claude-code"),[_,k]=U.useState(u$),[j,C]=U.useState(!1),[T,A]=U.useState([]),[M,L]=U.useState(!1),[B,q]=U.useState(!1),F=U.useRef(null),J=U.useRef(null),te=U.useRef(null),W=U.useCallback(()=>C(!1),[]);U.useEffect(()=>{let $=!1;return o().then(O=>{if($||O.length===0)return;k(d$(O));const P=O.filter(yg);p(z=>{var I;return P.some(G=>G.id===z)?z:((I=P[0])==null?void 0:I.id)??z})}).catch(()=>{}),()=>{$=!0}},[o]),U.useEffect(()=>{let $=!1;return c().then(O=>{$||A(O.templates.map(P=>({...P,kind:"gallery"})).slice(0,x$))}).catch(()=>{}),()=>{$=!0}},[c]);const se=$=>{p($),Vn({preferredHarness:$==="codex"?"codex":"claude-code"}),W()},ee=$=>{B||(q(!0),window.setTimeout($,170))},H=()=>ee(()=>t(x.trim(),b));return h.jsxs("div",{className:"composer-home"+(B?" is-leaving":""),"data-testid":"new-session-composer",...Ft({surface:"composer"}),children:[h.jsxs("div",{className:"composer-hero",children:[h.jsxs("p",{className:"composer-greeting","data-testid":"composer-greeting",children:[C$(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:w$.map($=>h.jsx("button",{type:"button",role:"listitem",className:"composer-chip","data-testid":`composer-chip-${E$($.label)}`,onClick:()=>{var O;g($.prompt),(O=F.current)==null||O.focus()},children:$.label},$.label))}),h.jsxs("div",{className:"composer-box",children:[h.jsx("textarea",{ref:F,className:"composer-input","data-testid":"composer-input",placeholder:"Describe the outcome you want",value:x,rows:2,autoFocus:!0,onChange:$=>g($.target.value),onKeyDown:$=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),H())}}),h.jsxs("div",{className:"composer-box-actions",children:[h.jsx("button",{ref:te,type:"button",className:"composer-attach","data-testid":"composer-open-folder","aria-label":"Open a folder or connect a workspace","data-tooltip":"Open a folder or connect a workspace",onClick:()=>L(!0),children:h.jsx(de,{name:"Plus",size:16})}),h.jsxs("div",{className:"composer-box-right",children:[h.jsxs("button",{ref:J,type:"button",className:"harness-select composer-harness","data-testid":"composer-harness-select","aria-haspopup":"menu","aria-expanded":j,"aria-label":"Coding agent for this session","data-tooltip":"Which coding agent runs this session",onClick:()=>C($=>!$),children:[h.jsx(Sg,{kind:b,size:14}),h.jsx("span",{className:"harness-select-label",children:f$(_,b)}),h.jsx("span",{className:"disclosure-caret"+(j?" is-open":""),"aria-hidden":"true",children:h.jsx(de,{name:"ChevronDown",size:12})})]}),h.jsx(fn,{open:j,anchorRef:J,onDismiss:W,placement:"up-end",className:"session-menu harness-select-menu",role:"menu",testid:"composer-harness-menu",children:h.jsx(S$,{entries:_,activeId:b,testidPrefix:"composer-harness-option",onPick:se})}),h.jsx("button",{type:"button",className:"composer-send","data-testid":"composer-send","aria-label":"Start session",title:"Start session",onClick:H,children:h.jsx(de,{name:"ArrowUp",size:16})})]})]})]})]}),T.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:r,children:["Browse all templates ",h.jsx(de,{name:"ChevronRight",size:13})]})]}),h.jsx("div",{className:"composer-template-grid",children:T.map(($,O)=>h.jsxs("button",{type:"button",className:"composer-template-card","data-testid":`composer-template-${$.id}`,onClick:()=>ee(()=>n($)),children:[h.jsxs("span",{className:"composer-template-cardhead",children:[h.jsx("span",{className:"composer-template-name",children:$.name}),O===0&&h.jsx("span",{className:"composer-template-suggested",children:"Suggested"})]}),h.jsx("span",{className:"composer-template-desc",children:$.description}),h.jsxs("span",{className:"composer-template-meta",children:[$.stepCount," ",$.stepCount===1?"step":"steps"," ·"," ",hg($.complexity),$.capabilities.length>0&&` · ${$.capabilities.length} ${$.capabilities.length===1?"capability":"capabilities"}`]})]},$.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":f,"data-testid":"welcome-telemetry-toggle",className:"toggle-switch"+(f?" is-on":""),onClick:()=>void l(!f),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})]})]}),M&&h.jsx(bg,{recentDirs:d,projectRoot:m,listDir:y,onClose:()=>L(!1),onConnect:v,onScan:S,triggerRef:te})]})}function j$({firstRun:e,appVersion:t,recentDirs:n,projectRoot:r,listDir:o,onConnect:c,onScan:f,onBrowseTemplates:l,onDismiss:d}){const[m,y]=U.useState(!1),v=U.useRef(null),S=U.useRef(d);return S.current=d,U.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:_j,target:"_blank",rel:"noopener noreferrer",children:["Read documentation ",h.jsx(de,{name:"ArrowUpRight",size:12})]})]})]}),m&&h.jsx(bg,{recentDirs:n,projectRoot:r,listDir:o,onClose:()=>y(!1),onConnect:c,onScan:f,triggerRef:v})]})}const A$="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",Rw=89,mh=24,R$=19.9385,T$=(mh-R$)/mh;function N$({height:e=16,className:t,style:n,...r}){const o=!!r["aria-label"];return h.jsx("svg",{...r,className:["brand-logotype",t].filter(Boolean).join(" "),style:{"--brand-logotype-descender":`${T$*e}px`,...n},width:Rw/mh*e,height:e,viewBox:`0 0 ${Rw} ${mh}`,fill:"none",focusable:"false",role:o?"img":void 0,"aria-hidden":o?void 0:!0,children:h.jsx("path",{d:A$,fill:"currentColor"})})}function M$({canGoBack:e,canGoForward:t,onGoBack:n,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:n,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 O$({onCollapse:e,canGoBack:t,canGoForward:n,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(N$,{height:13,"aria-hidden":!0}),h.jsx("span",{className:"visually-hidden",children:"Sapiom "})]}),h.jsx("span",{className:"brand-product",children:"agent.studio"})]}),h.jsx(M$,{canGoBack:t,canGoForward:n,onGoBack:r,onGoForward:o})]})}function $m(e){const t=Math.round(e*100)/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function D$(e){switch(e.kind){case"limit":return`${$m(e.usedUsd)} / ${$m(e.limitUsd)}`;case"balance":return`${$m(e.availableUsd)} available`;case"none":return null}}function $$({plan:e}){const[t,n]=U.useState(!1),r=U.useRef(null),o=U.useCallback(()=>n(!1),[]);if(!e)return null;const c=D$(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:mb,target:"_blank",rel:"noreferrer","data-testid":"plan-upgrade",onClick:()=>Ql("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:()=>n(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(mb,"_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(vj,"_blank","noopener,noreferrer"),o()},children:[h.jsx(de,{name:"ExternalLink",size:13}),"View usage"]})]})]})})}function L$({desktop:e,version:t,onToast:n}){const[r,o]=U.useState(!1),c=async()=>{if(!r){o(!0);try{const f=await e.checkForUpdates();f.kind!=="downloaded"&&n(S2(f).text)}catch{n("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 kd({testid:e,icon:t,label:n,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:n})}),h.jsx("span",{className:"menu-choice-mark","aria-hidden":"true",children:r&&h.jsx(de,{name:"Check",size:13})})]})}const I$=_g[0],E2={vscode:"VS Code","vscode-insiders":"VS Code Insiders",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"},P$=_g.map(e=>({kind:e,label:E2[e]}));function Nh(e){return _g.includes(e)?e:I$}function Tw(e){return E2[Nh(e)]}function B$(e,t){const n=t.replace(/\\/g,"/"),r=n.startsWith("/")?n:`/${n}`;return`${Nh(e)}://file${encodeURI(r)}`}function H$({authenticated:e,organizationName:t,telemetryOptIn:n,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]=U.useState(!1),[g,b]=U.useState({status:"idle"}),p=o==="env-forced-off",_=p?!1:n,k=p?!1:r,j=async()=>{const L=!n;x(!0);try{await f(L),Ql("consent.changed",{optIn:L})}finally{x(!1)}},C=async()=>{const L=!r;x(!0);try{await l(L),Ql("consent.changed",{productAnalytics:L})}finally{x(!1)}},T=async()=>{x(!0);try{await m(!d)}finally{x(!1)}},A=async L=>{x(!0);try{await v(L)}finally{x(!1)}},M=async()=>{b({status:"pending"});try{await S()}catch(L){const B=L instanceof Error?L.message:"Could not start sign-in. Try again.";b({status:"error",message:B})}};return e&&g.status==="pending"&&b({status:"idle"}),h.jsxs(x2,{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})]})}),zv(),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 j(),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:l$.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 T(),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:Nh(y),disabled:R,onChange:L=>void A(L.target.value),children:P$.map(L=>h.jsx("option",{value:L.kind,children:L.label},L.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 Nw({workflow:e,isFocused:t,onFocus:n}){const r=yo(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}`,...Ft({object:"agent"}),children:h.jsxs("button",{className:"tree-row workflow-item-trigger",onClick:()=>n(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:Vv(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 z$=6e4,U$=Vw();function q$(e){return e.plan!==null||e.readout.kind!=="none"}function F$(e){const[t,n]=U.useState(null);return U.useEffect(()=>{let r=!1;n(null);const o=()=>{U$.getAccountPlan().then(f=>{r||n(q$(f)?f:null)},()=>{r||n(null)})};o();const c=setInterval(o,z$);return()=>{r=!0,clearInterval(c)}},[e]),t}const V$=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),W$=V$?"⌘K":"Ctrl+K";function G$({label:e,cwd:t,isDirectory:n=!0,collapsed:r,onToggleCollapsed:o,onCopyPath:c}){return h.jsxs("div",{className:"workspace-row","data-testid":`workspace-group-${e}`,...Ft({object:"workspace"}),children:[h.jsxs("button",{className:"workspace-row-main",onClick:o,title:n?t:e,"aria-expanded":!r,children:[n&&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})})]}),n&&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 K$({label:e,cwd:t,sessionId:n,isFocused:r,onFocus:o,onScaffold:c,onCopyPath:f}){return h.jsxs("div",{className:"workspace-row"+(r?" is-selected":""),"data-testid":`workspace-group-${e}`,...Ft({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(n),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 Y$({label:e,cwd:t,isFocused:n,onFocus:r}){return h.jsxs("div",{className:"workspace-row"+(n?" is-selected":""),"data-testid":`workspace-group-${e}`,...Ft({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 Mw({testid:e,harness:t,title:n,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,...Ft({object:"session"}),children:[h.jsx("span",{className:"session-item-icon",children:h.jsx(Sg,{kind:t,size:13})}),h.jsxs("span",{className:"session-item-copy",children:[h.jsx("span",{className:"session-item-title",children:n}),h.jsx("span",{className:"session-item-meta",children:r})]})]})}function X$({width:e,minWidth:t,workflows:n,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:j,onOpenHistory:C,recentDirs:T,launchDir:A,listDir:M,onCreateSession:L,listHarnesses:B,onScaffoldSession:q,onScaffoldInSession:F,projectRoot:J,onSaveProjectRoot:te,onBrowseTemplates:W,templatesActive:se,onScanWorkflows:ee,onToast:H,telemetryOptIn:$,productAnalyticsOptIn:O,rollingSummary:P,consentSource:z,consentEnvReason:I,authenticated:G,organizationName:ie,onToggleTelemetry:X,onToggleProductAnalytics:V,onToggleRollingSummary:ce,editor:ae,onSelectEditor:Y,onStartAuth:Z,onDisconnect:ue,settingsOpen:we,onSetSettingsOpen:Ae}){const Ie=F$(G),[$e,ct]=U.useState(null);U.useEffect(()=>{const ke=xr();if(ke!=null&&ke.onUpdateState)return ke.onUpdateState(Xe=>{ct(Xe.kind==="downloaded"?{version:Xe.version}:null)})},[]);const[ut,mt]=U.useState(!1),et=U.useRef(null),vt=U.useRef(null),[tt,Ke]=U.useState(!1),[Ot,jt]=U.useState(!1),[fs,Dt]=U.useState(()=>dn().railGrouping??"workspace"),[xt,gs]=U.useState(()=>dn().railSort??"recent"),It=ke=>{Dt(ke),Vn({railGrouping:ke}),jt(!1)},gt=ke=>{gs(ke),Vn({railSort:ke}),jt(!1)},_s=U.useRef(null),Fe=U.useCallback(()=>{Ke(!1),jt(!1)},[]),[Ts,ts]=U.useState(()=>new Set(dn().collapsedCwds??[])),vi=ke=>{ts(Xe=>{const Vt=new Set(Xe);return Vt.has(ke)?Vt.delete(ke):Vt.add(ke),Vt})};U.useEffect(()=>{Vn({collapsedCwds:Array.from(Ts)})},[Ts]);const ps=r.filter(ke=>ke.status==="exited"),Gs=()=>{const ke=!tt;if(jt(!1),Ke(ke),ke){const Xe=YC(r,T,c);Xe.length>0&&C(Xe)}},ri=new Set(r.map(ke=>ke.id)),Zs=new Set(r.map(ke=>ke.agentSessionId).filter(ke=>ke!=null)),ys=k.filter(ke=>!(ke.harnessSessionId!=null&&ri.has(ke.harnessSessionId))&&!Zs.has(ke.agentSessionId)),Ds=[...ps.map(ke=>({kind:"exited",at:ke.lastActiveAt,session:ke})),...ys.map(ke=>({kind:"summary",at:ke.lastActiveAt,summary:ke}))].sort((ke,Xe)=>Xe.at.localeCompare(ke.at)),ai=new Map(k.map(ke=>[ke.agentSessionId,ke])),{workspaces:Is,orphanAgents:$s}=H4(n,r,fs,xt,T,o.map(ke=>ke.cwd)),st=Is.length===0&&$s.length===0,Ge=ke=>{var Xe;(Xe=navigator.clipboard)==null||Xe.writeText(ke).then(()=>H("Path copied.","success")).catch(()=>H("Couldn't copy the path."))};return h.jsxs("aside",{ref:vt,className:"rail rail-workflows",style:{width:e,minWidth:t},...Ft({surface:"agent_rail"}),children:[h.jsx(O$,{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"+(st?" is-empty":""),"data-testid":"rail-create-new","aria-label":"Create a new agent",onClick:()=>{Ke(!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:W$})]}),h.jsxs("button",{type:"button",className:"rail-nav-row"+(se?" is-selected":""),"data-testid":"rail-templates","aria-current":se?"page":void 0,onClick:W,children:[h.jsx(de,{name:"LayoutTemplate",size:14}),h.jsx("span",{children:"Templates"})]}),h.jsxs("button",{type:"button",ref:et,className:"rail-nav-row","data-testid":"add-existing-agents","aria-haspopup":"dialog","aria-expanded":ut,onClick:()=>{Ke(!1),mt(!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:_s,className:"theme-toggle rail-header-btn","data-testid":"history-trigger","aria-label":"Workspace options","aria-haspopup":"menu","aria-expanded":tt,"data-tooltip":"Grouping, sorting and past sessions",onClick:Gs,children:h.jsx(de,{name:"MoreHorizontal",size:14})})})]}),h.jsxs("div",{className:"rail-tree",children:[h.jsx(fn,{open:tt,anchorRef:_s,onDismiss:Fe,placement:"right-start",besideRef:vt,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:Fe,"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:()=>jt(!1),children:[h.jsx("div",{className:"session-dropdown-section",children:"Group by"}),h.jsx(kd,{testid:"group-workspace",icon:"FolderOpen",label:"Workspace",checked:fs==="workspace",onPick:()=>It("workspace")}),h.jsx(kd,{testid:"group-deployment",icon:"Cloud",label:"Deployment",checked:fs==="deployment",onPick:()=>It("deployment")}),h.jsx("div",{className:"session-dropdown-section",children:"Sort"}),h.jsx(kd,{testid:"sort-recent",icon:"History",label:"Recent activity",checked:xt==="recent",onPick:()=>gt("recent")}),h.jsx(kd,{testid:"sort-name",icon:"ArrowDown",label:"Name",checked:xt==="name",onPick:()=>gt("name")})]}),h.jsxs("button",{type:"button",className:"session-dropdown-item nested-trigger"+(Ot?" is-open":""),"data-testid":"past-sessions-trigger","aria-haspopup":"menu","aria-expanded":Ot,onMouseEnter:()=>jt(!0),onClick:()=>jt(ke=>!ke),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})]})]})]}),Ot&&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:()=>jt(!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:[Ds.map(ke=>{if(ke.kind==="exited"){const Xe=ke.session.agentSessionId==null?void 0:ai.get(ke.session.agentSessionId),Vt=ke.session.agentSessionId==null?"rehydrate":Xe==null?void 0:Xe.resumeMode;return h.jsx(Mw,{testid:`exited-session-${ke.session.id}`,harness:ke.session.harness,title:ke.session.title,meta:Nv({...ke.session,gitBranch:Xe==null?void 0:Xe.gitBranch,turnCount:Xe==null?void 0:Xe.turnCount,messageCount:Xe==null?void 0:Xe.messageCount},void 0,{includeHarness:!1,state:B1({resumeMode:Vt,turnCount:Xe==null?void 0:Xe.turnCount})}),cwd:ke.session.cwd,resumeMode:Vt,isSelected:ke.session.id===c,onOpen:()=>{x(ke.session.id),Fe()}},ke.session.id)}return h.jsx(Mw,{testid:`history-${ke.summary.agentSessionId}`,harness:ke.summary.harness,title:ke.summary.title,meta:Nv(ke.summary,void 0,{includeHarness:!1,state:B1(ke.summary)}),cwd:ke.summary.cwd,resumeMode:ke.summary.resumeMode,isSelected:!1,onOpen:()=>{_(ke.summary),Fe()}},ke.summary.agentSessionId)}),j&&h.jsx("div",{className:"session-dropdown-empty",children:"Loading…"}),!j&&Ds.length===0&&h.jsx("div",{className:"session-dropdown-empty",children:"No past sessions yet"})]})]})]})]})}),h.jsxs("div",{className:"rail-list",children:[Is.length===0&&$s.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."}),Is.map(ke=>{const Xe=Ts.has(ke.cwd);if(ke.pending)return h.jsx("div",{className:"workspace-group",children:h.jsx(Y$,{label:ke.label,cwd:ke.cwd,isFocused:ke.cwd===f,onFocus:l})},ke.cwd);if(ke.agents.length===0&&ke.bareSessions.length>0){const Ns=ke.bareSessions[0];return h.jsx("div",{className:"workspace-group",children:h.jsx(K$,{label:ke.label,cwd:ke.cwd,sessionId:Ns.id,isFocused:ke.cwd===f,onFocus:l,onScaffold:F,onCopyPath:Ge})},ke.cwd)}return h.jsxs("div",{className:"workspace-group",children:[h.jsx(G$,{label:ke.label,cwd:ke.cwd,isDirectory:ke.isDirectory,collapsed:Xe,onToggleCollapsed:()=>vi(ke.cwd),onCopyPath:Ge}),!Xe&&ke.agents.map(Ns=>h.jsx(Nw,{workflow:Ns.workflow,isFocused:Ns.workflow.path===f,onFocus:l},Ns.workflow.path))]},ke.cwd)}),$s.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"})]})}),$s.map(ke=>h.jsx(Nw,{workflow:ke.workflow,isFocused:ke.workflow.path===f,onFocus:l},ke.workflow.path))]})]})]}),h.jsxs("div",{className:"rail-footer",children:[$e&&(()=>{const ke=xr();return ke?h.jsx(L$,{desktop:ke,version:$e.version,onToast:H}):null})(),h.jsx($$,{plan:Ie}),h.jsx(J$,{onToast:H,authenticated:G,organizationName:ie,telemetryOptIn:$,productAnalyticsOptIn:O,rollingSummary:P,consentSource:z,consentEnvReason:I,onToggleTelemetry:X,onToggleProductAnalytics:V,onToggleRollingSummary:ce,editor:ae,onSelectEditor:Y,onStartAuth:Z,onDisconnect:ue,settingsOpen:we,onSetSettingsOpen:Ae,overviewSelected:g,onSelectOverview:b})]}),ut&&h.jsx(bg,{recentDirs:T,launchDir:A,projectRoot:J,listDir:M,onClose:()=>mt(!1),onConnect:m,onScan:ee,triggerRef:et})]})}function J$({authenticated:e,organizationName:t,telemetryOptIn:n,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]=U.useState(!1),[j,C]=U.useState(vh());U.useEffect(()=>Hv(C),[]);const[T,A]=U.useState({status:"idle"}),M=U.useRef(null),L=U.useCallback(()=>k(!1),[]),B=U.useCallback(()=>x(!1),[x]),q=zv(),F=T.status==="pending",J=xr(),[te,W]=U.useState(!1),se=async()=>{if(!(!J||te)){W(!0),L();try{const P=await J.checkForUpdates(),z=S2(P);p(z.text,z.tone==="error"?"error":P.kind==="up-to-date"||P.kind==="downloaded"?"success":"info")}catch{p("Couldn't check for updates.")}finally{W(!1)}}};e&&T.status==="pending"&&A({status:"idle"});const ee=F?"Connecting…":e?t??"Signed in":"Not signed in",H=F?"opening browser":e?"Sapiom account":"connect to get started",$=(t??"S").charAt(0).toUpperCase(),O=async()=>{L(),A({status:"pending"});try{await S()}catch(P){const z=P instanceof Error?P.message:"Could not start sign-in. Try again.";A({status:"error",message:z})}};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 P=!_;k(P),P&&B()},children:[h.jsx("span",{className:"rail-profile-avatar","aria-hidden":"true",children:$}),h.jsxs("span",{className:"rail-profile-copy",children:[h.jsx("span",{className:"rail-profile-name",children:ee}),h.jsxs("span",{className:"rail-profile-meta",children:[h.jsx("span",{className:"identity-dot","data-authenticated":e,"data-pending":F}),H]})]}),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(H$,{authenticated:e,organizationName:t,telemetryOptIn:n,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:L,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(),L()},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(Kw,"_blank","noopener,noreferrer"),L()},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),L()},children:[h.jsx(de,{name:"Settings",size:13}),"Settings"]}),h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"theme-toggle",onClick:()=>{qw(),L()},children:[h.jsx(de,{name:j==="dark"?"Sun":"Moon",size:13}),j==="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:te,onClick:()=>void se(),children:[h.jsx(de,{name:te?"Loader":"RefreshCw",size:13}),te?"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:F,onClick:()=>void O(),children:[h.jsx(de,{name:"Plug",size:13}),F?"Connecting…":"Connect account"]}),e&&h.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-disconnect-account",onClick:()=>{w(),L()},children:[h.jsx(de,{name:"LogOut",size:13}),"Disconnect"]}),q,T.status==="error"&&h.jsx("p",{className:"profile-menu-auth-error","data-testid":"profile-auth-error",children:T.message})]})]})}const Z$=new Set([401,403]);function Q$(e){return e?e.networkError===!0||e.status===void 0:!1}function e6(e){return(e==null?void 0:e.status)!==void 0&&Z$.has(e.status)}function t6(e){const{online:t,error:n}=e;return!t||Q$(n)?"offline":e6(n)?"auth":n?"error":"online"}function Ow(){return typeof navigator>"u"?!0:navigator.onLine!==!1}function s6(){const[e,t]=U.useState(Ow);return U.useEffect(()=>{const n=()=>t(Ow());return window.addEventListener("online",n),window.addEventListener("offline",n),n(),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",n)}},[]),e}function Dw(e,t){return e!=null&&e.workflowPath===t}function i6(e=typeof window>"u"?"":window.location.search){const t=new URLSearchParams(e),n=t.get("agent");if(n){const o=t.get("agentSlug");return{kind:"agent",definitionId:n,...o?{slug:o}:{}}}const r=t.get("template");if(r){const o=t.get("templateSlug");return{kind:"template",templateId:r,...o?{slug:o}:{}}}return null}function n6({agentLabel:e,onCancel:t,onConfirm:n}){const r=U.useRef(null);return bo(!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:n,children:"Clone locally"})]})]})})}const $w=120,k2=new Set(["attr__class","attr__id"]),r6=/attr__([\w-]+)="(?:\\.|[^"\\])*"/g,a6=/(?:current_url|referrer|pathname)$/,o6=/host$/;function l6(e){const t=typeof e.surface=="string"?e.surface.toLowerCase():"",n=typeof e.object=="string"?e.object.toLowerCase():"";return/secret|vault|credential/.test(t)||/secret|vault|credential/.test(n)}const c6=new Set(["agent","workspace","session","run","directory"]);function u6(e){const t=typeof e.object=="string"?e.object.toLowerCase():"";return c6.has(t)}const d6=/\btext="(?:\\.|[^"\\])*"/g,j2=new Set(["localhost","127.0.0.1","[::1]","::1"]),A2="localhost";function Lm(e){if(typeof e!="string"||e.length===0)return e;let t;try{t=new URL(e)}catch{return e}return`${j2.has(t.hostname)?`${t.protocol}//${A2}`:t.origin}${t.pathname}`}function Lw(e){if(typeof e!="string"||e.length===0)return e;const t=e.replace(/:\d+$/,"");return j2.has(t)?A2:e}function wg(e){return e.length>$w?`${e.slice(0,$w)}…`:e}function h6(e){return l6(e)?"secret":u6(e)?"drop_name":"truncate"}function f6(e,t){for(const n of Object.keys(e))n.startsWith("attr__")&&!k2.has(n)&&delete e[n];if(t==="truncate"){typeof e.$el_text=="string"&&(e.$el_text=wg(e.$el_text));return}delete e.$el_text}function p6(e,t){const n=e.$elements;if(Array.isArray(n))for(const o of n)o&&typeof o=="object"&&f6(o,t);if(typeof e.$elements_chain!="string")return;if(t==="secret"){delete e.$elements_chain;return}let r=e.$elements_chain.replace(r6,(o,c)=>k2.has(`attr__${c}`)?o:"");t==="drop_name"&&(r=r.replace(d6,'text=""')),e.$elements_chain=r}function m6(e,t){t.$current_url=Lm(t.$current_url),t.$referrer=Lm(t.$referrer),t.$host=Lw(t.$host);for(const n of[e.$set,e.$set_once]){if(!n)continue;const r=n;for(const o of Object.keys(r))a6.test(o)?r[o]=Lm(r[o]):o6.test(o)&&(r[o]=Lw(r[o]))}}const v6=/attr__aria-label="((?:\\.|[^"\\])*)"/i;function g6(e){var o;const t=e.$el_text;if(typeof t=="string"&&t.trim()!=="")return;let n;const r=e.$elements;if(Array.isArray(r))for(const c of r){const f=c==null?void 0:c["attr__aria-label"];if(typeof f=="string"&&f.trim()!==""){n=f;break}}n===void 0&&typeof e.$elements_chain=="string"&&(n=(o=v6.exec(e.$elements_chain))==null?void 0:o[1]),n!==void 0&&n.trim()!==""&&(e.$el_text=wg(n),e.el_text_source="aria_label")}function _6(e,t){typeof e.$el_text=="string"&&(t==="truncate"?e.$el_text=wg(e.$el_text):delete e.$el_text),t==="truncate"&&g6(e),p6(e,t)}function y6(e){if(!e)return e;try{const t=e.properties??{},n=h6(t);return m6(e,t),_6(t,n),e.properties=t,e}catch{return e}}function b6(){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 S6(e){return e.consentSource==="env-forced-off"}function R2(e){return!S6(e)&&e.productAnalyticsOptIn}let ho=!1;function w6(e){if(ho){Im(e),Bm(e);return}const t=b6();if(t&&R2(e)){if(Ti.__loaded){ho=!0,Dv(e),Im(e),Bm(e);return}Ti.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:y6,persistence:"localStorage",disable_session_recording:!0}),ho=!0,Dv(e),Im(e),Bm(e)}}function Im(e){if(ho)try{R2(e)?Ti.has_opted_out_capturing()&&Ti.opt_in_capturing():Ti.has_opted_out_capturing()||Ti.opt_out_capturing()}catch{}}function Dv(e){cg({app_version:e.version,harness_host:xr()?"desktop":"cli",studio_boot_id:a4()})}let Pm=null;function Bm(e){if(ho)try{if(e.authenticated&&e.userId){Pm=e.userId,Ti.identify(e.userId),e.tenantId&&Ti.group("organization",e.tenantId,{...e.organizationName?{name:e.organizationName}:{}}),cg({active_organization_id:e.tenantId??void 0,app_version:e.version});return}Pm&&(Pm=null,Ti.reset(),Dv(e))}catch{}}function x6(e){if(ho)try{e?cg({harness_kind:e}):Ti.unregister("harness_kind")}catch{}}function C6(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(`
|
|
487
|
-
`)}const E6={entries:[],index:-1};function k6(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 T2(e){return e.index>0}function N2(e){return e.index>=0&&e.index<e.entries.length-1}function j6(e,t){const n=e.index>=0?e.entries[e.index]:null;if(n&&k6(n,t)){if(JSON.stringify(n)===JSON.stringify(t))return e;const c=[...e.entries];return c[e.index]=t,{...e,entries:c}}const o=[...e.entries.slice(0,e.index+1),t].slice(-50);return{entries:o,index:o.length-1}}function A6(e,t){if(!(t==="back"?T2(e):N2(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 R6(){const[e,t]=U.useState(E6),n=U.useRef(e);n.current=e;const r=U.useCallback(c=>{const f=j6(n.current,c);f!==n.current&&(n.current=f,t(f))},[]),o=U.useCallback(c=>{const f=A6(n.current,c);return f.visit?(n.current=f.state,t(f.state),f.visit):null},[]);return{canGoBack:T2(e),canGoForward:N2(e),record:r,goBack:()=>o("back"),goForward:()=>o("forward")}}const M2="(max-width: 768px)";function $v(){return typeof window<"u"&&window.matchMedia(M2).matches}function T6(e){const t=window.matchMedia(M2);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function N6(){return U.useSyncExternalStore(T6,$v,()=>!1)}const O2="sapiom-harness-pane-widths",xg=180,D2=480,Lv=320,ec=320,$2=720;function Iv(e,t,n){return Math.min(Math.max(e,t),n)}function M6(){const e={rail:Lv,canvas:null};if(typeof window>"u")return e;try{const t=window.localStorage.getItem(O2);if(!t)return e;const n=JSON.parse(t);return{rail:Iv(typeof n.rail=="number"?n.rail:Lv,xg,D2),canvas:typeof n.canvas=="number"?Iv(n.canvas,ec,$2):null}}catch{return e}}function Iw(e){window.localStorage.setItem(O2,JSON.stringify(e))}function O6(){const[e,t]=U.useState(M6),[n,r]=U.useState(!1),[o,c]=U.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 j=Iv(b+(k.clientX-g)*m,y,v);t(C=>C[d]===j?C:{...C,[d]:j})},_=()=>{x.removeEventListener("pointermove",p),x.removeEventListener("pointerup",_),w==null||w(!1),t(k=>(Iw(k),k))};x.addEventListener("pointermove",p),x.addEventListener("pointerup",_)},l=(d,m)=>{t(y=>{const v={...y,[d]:m};return Iw(v),v})};return{widths:e,canvasResizing:n,railResizing:o,startRailDrag:f("rail",1,xg,D2,()=>e.rail,c),startCanvasDrag:f("canvas",-1,ec,$2,()=>{if(e.canvas!=null)return e.canvas;const d=document.querySelector(".canvas-pane");return d?d.getBoundingClientRect().width:ec},r),resetRail:()=>{c(!0),l("rail",Lv),window.setTimeout(()=>c(!1),0)},resetCanvas:()=>{r(!0),l("canvas",null),window.setTimeout(()=>r(!1),0)}}}function qs(e,t="error"){return{message:e,tone:t}}const D6=2e3;function $6(e){const t=new URL("/ws/events",window.location.href);t.protocol=t.protocol==="https:"?"wss:":"ws:",t.searchParams.set("token",ao());let n=null,r=null,o=!1;const c=()=>{n=new WebSocket(t),n.addEventListener("message",f=>{try{e(JSON.parse(f.data))}catch{}}),n.addEventListener("close",()=>{o||(r=setTimeout(c,D6))})};return c(),()=>{o=!0,r&&clearTimeout(r),n==null||n.close()}}function jd(e){const t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]??e}function L6(e,t){const n=[];for(const r of t)e.has(r.path)||n.push(r.path);return n}function Pw(e,t){return t?"exception":e==="linking"?"link_failed":"build_failed"}function I6(e){return e==="cancelled"?"cancelled":"failed"}function P6(e){return e==="completed"?"succeeded":e==="failed"?"failed":"pending"}const B6=5;function H6(){return{started:!1,settled:!1,observed:!1,failures:0}}const Ad={event:null};function z6(e,t,n=B6){if(t.kind==="announced")return t.duplicate||e.started?{state:e,emit:Ad}:{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:Ad};if(e.settled)return{state:c,emit:Ad};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:I6(t.status)}}}const r=e.failures+1,o={...e,failures:r};return r<n||e.settled?{state:o,emit:Ad}:{state:{...o,settled:!0},emit:{event:"agent.run_failed",error_kind:e.observed?"exception":"unobservable"}}}function Fl(e){return typeof e=="string"&&e!==""?e:void 0}function U6(e){if(Fl(e.templateId))return"template";const t=Fl(e.starterId);return t&&t!=="default"?"starter":Fl(e.forkId)?"fork":"scratch"}function Bw(e){if(!e)return{};const t=U6(e);return t==="template"?{source:t,template_id:Fl(e.templateId)}:t==="starter"?{source:t,template_id:Fl(e.starterId)}:{source:t}}const Hw=4e3;function q6(e){if(typeof e=="string")return e;if(e!==null&&typeof e=="object"){const t=e,n=[t.ts,t.level,t.msg??t.message].filter(r=>typeof r=="string"||typeof r=="number");if(n.length>0)return n.map(String).join(" ")}return String(e)}function F6(e){if(!Array.isArray(e)||e.length===0)return;const t=e.map(q6).join(`
|
|
488
|
-
`).trim();if(t!=="")return t.length>Hw?t.slice(t.length-Hw):t}function V6(e){return e==="running"?"running":e==="succeeded"?"passed":e==="threw"?"failed":"pending"}function W6(e){return e==="completed"?"completed":e==="failed"?"failed":"running"}function G6(e){var r;const t={id:`${e.step}-${e.attempt}`,name:e.step,attempt:e.attempt,status:V6(e.status)};if(e.startedAt&&(t.startedAt=e.startedAt),e.finishedAt&&(t.finishedAt=e.finishedAt),e.startedAt&&e.finishedAt){const o=Date.parse(e.startedAt),c=Date.parse(e.finishedAt);Number.isFinite(o)&&Number.isFinite(c)&&c>=o&&(t.latencyMs=c-o)}e.input!==void 0&&(t.input=e.input),e.output!==void 0&&(t.output=e.output),e.sharedStateAfter!==void 0&&(t.sharedState=e.sharedStateAfter),e.directive!==void 0&&(t.directive=e.directive),(r=e.error)!=null&&r.message&&(t.error=e.error.message);const n=F6(e.logs);return n!==void 0&&(t.logSlice=n),e.calls&&e.calls.length>0&&(t.calls=e.calls.map(o=>({capability:o.capability,stubUsed:o.stubUsed,args:o.args,result:o.result}))),t}function K6(e,t={}){const n={executionId:t.executionId??"",status:W6(t.outcome),steps:e.map(G6),stubbed:!0};return t.unusedStubs&&t.unusedStubs.length>0&&(n.unusedStubs=t.unusedStubs),t.stubWarnings&&t.stubWarnings.length>0&&(n.stubWarnings=t.stubWarnings),t.input!==void 0&&(n.input=t.input),t.output!==void 0&&(n.output=t.output),t.error!==void 0&&(n.error=t.error),t.startedAt&&(n.startedAt=t.startedAt),t.finishedAt&&(n.finishedAt=t.finishedAt),n}const Ut=Vw(),Y6=3e3,X6=8,J6=500;function Z6(){const[e,t]=U.useState(null),[n,r]=U.useState(null),o=U.useRef(null);o.current=n;const c=U.useRef([]);c.current=(e==null?void 0:e.workflows)??[];const[f,l]=U.useState(!0),[d,m]=U.useState(null),[y,v]=U.useState(null),[S,w]=U.useState(0),[R,x]=U.useState(null),[g,b]=U.useState(null),[p,_]=U.useState([]),[k,j]=U.useState(null),[C,T]=U.useState(!1),A=U.useRef(new Map),M=U.useRef(0),L=U.useRef(new Map),[B,q]=U.useState(null),[F,J]=U.useState(new Set),[te,W]=U.useState([]),se=U.useRef(new Map),[ee,H]=U.useState(new Map),[$,O]=U.useState(new Map),[P,z]=U.useState(new Map),I=U.useRef(new Map),G=U.useRef(new Set),[ie,X]=U.useState(new Map),[V,ce]=U.useState(new Map),[ae,Y]=U.useState(new Map),Z=U.useCallback((oe,ge)=>{Y(ve=>{if(ge===null){if(!ve.has(oe))return ve;const Se=new Map(ve);return Se.delete(oe),Se}return new Map(ve).set(oe,ge)})},[]),[ue,we]=U.useState([]),Ae=U.useCallback(oe=>{we(ge=>ge.some(ve=>ve.cwd===oe)?ge:[{cwd:oe,sessionSeen:!1},...ge])},[]),Ie=U.useCallback(oe=>{we(ge=>ge.some(ve=>ve.cwd===oe)?ge.filter(ve=>ve.cwd!==oe):ge)},[]);U.useEffect(()=>{if(ue.length===0)return;const oe=(e==null?void 0:e.sessions)??[],ge=(e==null?void 0:e.workflows)??[],ve=(Se,Me)=>ug(Me,Se);we(Se=>{let Me=!1;const Je=[];for(const _t of Se){if(ge.some(yt=>ve(yt.path,_t.cwd))){Me=!0;continue}const Tt=oe.some(yt=>yt.status!=="exited"&&ve(yt.cwd,_t.cwd));if(_t.sessionSeen&&!Tt){Me=!0;continue}if(Tt&&!_t.sessionSeen){Je.push({..._t,sessionSeen:!0}),Me=!0;continue}Je.push(_t)}return Me?Je:Se})},[e==null?void 0:e.sessions,e==null?void 0:e.workflows,ue]);const[$e,ct]=U.useState(0),ut=U.useCallback(()=>{ct(oe=>oe+1)},[]),mt=U.useRef(0),et=U.useCallback(oe=>{mt.current+=1,b(oe)},[]),vt=U.useRef([]),tt=U.useCallback(oe=>{Ut.getRunState(oe).then(ge=>H(ve=>{const Se=ve.get(oe);return Se?new Map(ve).set(oe,{...Se,run:ge}):ve})).catch(()=>{})},[]),Ke=U.useCallback((oe,ge,ve)=>{const Se=I.current.get(oe);Se&&clearInterval(Se);const Me=ro(vt.current.find(Oe=>Oe.id===oe)),Je=Date.now();O(Oe=>{const Ze=Oe.get(oe)??[];return Ze.includes(ge)?Oe:new Map(Oe).set(oe,[...Ze,ge])}),z(Oe=>{if(!Oe.has(oe))return Oe;const Ze=new Map(Oe);return Ze.delete(oe),Ze});const Rt={workflow_slug:Me?jd(Me):void 0,session_id:oe,target:ve};let Tt=H6();const yt=Oe=>{const{state:Ze,emit:ot}=z6(Tt,Oe);if(Tt=Ze,ot.event===null)return;if(ot.event==="agent.run_started"){Os("agent.run_started",Rt);return}const bs=Date.now()-Je;if(ot.event==="agent.run_succeeded"){Os("agent.run_succeeded",{...Rt,duration_ms:bs});return}Os("agent.run_failed",{...Rt,duration_ms:bs,error_kind:ot.error_kind})},At=G.current.has(ge);if(G.current.size>=J6){const Oe=G.current.values().next().value;Oe!==void 0&&G.current.delete(Oe)}G.current.add(ge),yt({kind:"announced",duplicate:At});const _e=()=>{const Oe=I.current.get(oe);Oe&&clearInterval(Oe),I.current.delete(oe)},De=async()=>{try{const Oe=await Ut.getRunState(ge);H(Ze=>new Map(Ze).set(ge,{run:Oe,target:ve,workflowPath:Me,observedAt:Je})),yt({kind:"polled",status:Oe.status}),Oe.status!=="running"&&_e()}catch{yt({kind:"poll_failed"}),Tt.settled&&_e()}};De(),I.current.set(oe,setInterval(()=>void De(),2e3))},[]),Ot=U.useRef(0),jt=U.useCallback(async(oe,ge,ve)=>{Ot.current+=1;const Se=`local-${Date.now()}-${Ot.current}`,Me=ro(vt.current.find(He=>He.id===oe)),Je=Date.now(),_t=new Date(Je).toISOString(),Rt=[];let Tt,yt,At,_e,De,Oe;O(He=>{const lt=He.get(oe)??[];return lt.includes(Se)?He:new Map(He).set(oe,[...lt,Se])}),z(He=>{if(!He.has(oe))return He;const lt=new Map(He);return lt.delete(oe),lt});const Ze=()=>{const He=K6(Rt,{executionId:Se,outcome:Tt,unusedStubs:De,stubWarnings:Oe,input:ve,output:yt,error:At,startedAt:_t,finishedAt:_e});H(lt=>new Map(lt).set(Se,{run:He,target:"local",workflowPath:Me,observedAt:Je}))};Ze();const ot={workflow_slug:Me?jd(Me):void 0,session_id:oe,target:"local"};let bs=!1;Os("agent.run_started",ot);const Ve=He=>{if(He.kind==="summary")Tt=He.outcome,yt=He.output,At=He.error,_e=new Date().toISOString(),De=He.unusedStubs,Oe=He.stubWarnings;else if(He.kind==="error"){Tt="failed",At=He.error,_e=new Date().toISOString();const lt={step:"run-local",attempt:1,input:ve,status:"threw",startedAt:_t,finishedAt:_e,error:{name:"RunLocalError",message:He.error},logs:[]},ss=Rt.findIndex(Jt=>Jt.step===lt.step&&Jt.attempt===lt.attempt);ss>=0?Rt[ss]=lt:Rt.push(lt)}else if(He.kind==="step"){const lt=He.trace,ss=Rt.findIndex(Jt=>Jt.step===lt.step&&Jt.attempt===lt.attempt);ss>=0?Rt[ss]=lt:Rt.push(lt)}else{const lt=Rt.findIndex(ss=>ss.step===He.step&&ss.attempt===He.attempt);lt>=0?Rt[lt]=He:Rt.push(He)}Ze()};try{await Ut.runLocal({sourceDir:ge,input:ve},Ve)}catch(He){const lt=He instanceof ji&&He.reason?He.reason:He instanceof Error?He.message:"Local execution failed.";Tt="failed",bs=!0,At=lt,_e=new Date().toISOString();const ss={step:"run-local",attempt:1,input:ve,status:"threw",startedAt:_t,finishedAt:_e,error:{name:"RunLocalError",message:lt},logs:[{level:"error",msg:lt}]},Jt=Rt.findIndex(sn=>sn.step===ss.step&&sn.attempt===ss.attempt);Jt>=0?Rt[Jt]=ss:Rt.push(ss),Ze(),j(qs(lt))}finally{const He=P6(Tt),lt=Date.now()-Je;He==="succeeded"?Os("agent.run_succeeded",{...ot,duration_ms:lt}):He==="failed"&&Os("agent.run_failed",{...ot,duration_ms:lt,error_kind:bs?"exception":"failed"}),ut()}},[ut]),fs=U.useCallback((oe,ge)=>{z(ve=>new Map(ve).set(oe,ge)),tt(ge)},[tt]),Dt=U.useMemo(()=>{const oe=new Map;return $.forEach((ge,ve)=>{const Se=P.get(ve),Me=Se&&ge.includes(Se)?Se:ge[ge.length-1],Je=Me?ee.get(Me):void 0;Je&&oe.set(ve,Je)}),oe},[$,P,ee]);U.useEffect(()=>{vt.current=(e==null?void 0:e.sessions)??[]},[e]),U.useEffect(()=>{const oe=I.current;return()=>{oe.forEach(ge=>clearInterval(ge)),oe.clear()}},[]),U.useEffect(()=>{const oe=se.current;return()=>{oe.forEach(ge=>clearTimeout(ge)),oe.clear()}},[]);const xt=U.useRef(null);U.useEffect(()=>{let oe=!1;return S>0&&(l(!0),m(null),v(null)),Promise.all([Ut.getState(),Ut.getSettings()]).then(([ge,ve])=>{if(oe)return;t(ge);const Se=xt.current??(xt.current=new Set);for(const Je of ge.workflows)Se.add(Je.path);r(ve),v(null),ge.tasks&&W(ge.tasks);const Me=ge.sessions.find(Je=>Je.status!=="exited");Me&&b(Me.id),ge.workflows[0]&&x(ge.workflows[0].path)}).catch(ge=>{oe||(m(ge.message),v(ge instanceof ji?{status:ge.status}:{networkError:!0}))}).finally(()=>!oe&&l(!1)),()=>{oe=!0}},[S]);const gs=U.useCallback(()=>w(oe=>oe+1),[]);U.useEffect(()=>{if(!g)return;const oe=e==null?void 0:e.sessions.find(ge=>ge.id===g);x(ro(oe)??null)},[g]);const It=U.useCallback(async()=>{const oe=await Ut.listWorkflows();return t(ge=>ge&&{...ge,workflows:oe}),oe},[]);U.useEffect(()=>$6(oe=>{if(q(oe),oe.type==="session.status"){if(t(ge=>{if(!ge)return ge;const Se=ge.sessions.some(Me=>Me.id===oe.session.id)?ge.sessions.map(Me=>Me.id===oe.session.id?oe.session:Me):[...ge.sessions,oe.session];return{...ge,sessions:Se}}),oe.session.status==="exited"){const ge=oe.session.id,ve=se.current.get(ge);ve&&(clearTimeout(ve),se.current.delete(ge)),J(Se=>{if(!Se.has(ge))return Se;const Me=new Set(Se);return Me.delete(ge),Me})}}else if(oe.type==="workflows.changed")It().then(ge=>{const ve=xt.current;if(ve===null){xt.current=new Set(ge.map(Se=>Se.path));return}for(const Se of L6(ve,ge))ve.add(Se),Os("agent.created",{workflow_slug:jd(Se),...Bw(ge.find(Me=>Me.path===Se))})});else if(oe.type==="execution.started")Ke(oe.harnessSessionId,oe.executionId,oe.target);else if(oe.type==="port.detected")X(ge=>new Map(ge).set(oe.harnessSessionId,{port:oe.port,url:oe.url}));else if(oe.type==="task.status")W(ge=>ge.some(Se=>Se.id===oe.task.id)?ge.map(Se=>Se.id===oe.task.id?oe.task:Se):[...ge,oe.task]);else if(oe.type==="session.activity"){const ge=oe.harnessSessionId;J(Se=>Se.has(ge)?Se:new Set(Se).add(ge));const ve=se.current.get(ge);ve&&clearTimeout(ve),se.current.set(ge,setTimeout(()=>{se.current.delete(ge),J(Se=>{if(!Se.has(ge))return Se;const Me=new Set(Se);return Me.delete(ge),Me})},Y6))}else oe.type==="auth.changed"&&(t(ge=>ge&&{...ge,authenticated:oe.authenticated,organizationName:oe.organizationName}),It())}),[It,Ke]);const gt=U.useCallback(async oe=>{const ge=Array.from(new Set(oe)),ve=ge.map(Se=>{const Me=A.current.get(Se);if(Me)return Me;const Je=Ut.sessionHistory(Se).finally(()=>{A.current.delete(Se)});return A.current.set(Se,Je),Je});M.current+=1,T(!0);try{const Se=await Promise.allSettled(ve),Me=[],Je=new Set;Se.forEach((_t,Rt)=>{_t.status==="fulfilled"&&(Je.add(ge[Rt]),Me.push(..._t.value))}),_(_t=>S5(_t,Me,Je))}finally{M.current-=1,M.current===0&&T(!1)}},[]),_s=U.useCallback(async oe=>{var Se;const ge=await Ut.createSession(oe);t(Me=>Me&&!Me.sessions.some(Je=>Je.id===ge.id)?{...Me,sessions:[...Me.sessions,ge]}:Me),et(ge.id);const ve=[oe.cwd,...(((Se=o.current)==null?void 0:Se.recentDirs)??[]).filter(Me=>Me!==oe.cwd)].slice(0,X6);r(Me=>Me&&{...Me,recentDirs:ve});try{const Me=await Ut.updateSettings({recentDirs:ve});r(Je=>Je&&{...Je,recentDirs:Me.recentDirs})}catch{}return ge},[et]),Fe=U.useCallback(()=>Ut.listTemplates(),[]),Ts=U.useCallback(oe=>Ut.getTemplate(oe),[]),ts=U.useCallback(oe=>Ut.sessionRecord(oe),[]),vi=U.useCallback(async oe=>{const ge=mt.current;try{const ve=await Ut.resumeSession(oe);return t(Se=>Se&&{...Se,sessions:Se.sessions.map(Me=>Me.id===ve.id?ve:Me)}),mt.current===ge&&et(ve.id),ve}catch(ve){throw j(qs(ve instanceof ji&&ve.reason?ve.reason:ve.message)),ve}},[et]),ps=U.useCallback(async({cwd:oe,harness:ge,from:ve})=>{const Se=await _s({cwd:oe,harness:ge,rehydrateFrom:ve});return Se.rehydratedFrom||j(qs("Nothing was recorded for that session, so this one starts fresh.","info")),Se},[_s]),Gs=U.useCallback(async oe=>{var ve;const ge=oe.harnessSessionId??((ve=e==null?void 0:e.sessions.find(Se=>Se.agentSessionId===oe.agentSessionId))==null?void 0:ve.id);if(oe.resumeMode==="rehydrate")return ps({cwd:oe.cwd,harness:oe.harness,from:ge??oe.agentSessionId});if(ge)return vi(ge);try{const Se=await Ut.adoptSession({agentSessionId:oe.agentSessionId,harness:oe.harness,cwd:oe.cwd,title:oe.title,lastActiveAt:oe.lastActiveAt});return t(Me=>{if(!Me)return Me;const Je=Me.sessions.some(_t=>_t.id===Se.id)?Me.sessions.map(_t=>_t.id===Se.id?Se:_t):[...Me.sessions,Se];return{...Me,sessions:Je}}),et(Se.id),Se}catch(Se){throw j(qs(Se instanceof ji&&Se.reason?Se.reason:Se.message)),Se}},[e,vi,ps,et]),ri=U.useCallback(async oe=>{try{await Ut.killSession(oe)}catch(ve){throw j(qs(ve instanceof ji&&ve.reason?ve.reason:ve.message)),ve}const ge=((e==null?void 0:e.sessions)??[]).filter(ve=>ve.id!==oe);if(t(ve=>ve&&{...ve,sessions:ge}),g===oe){const ve=ge.find(Se=>Se.status!=="exited");et(ve?ve.id:null)}},[e,g,et]),Zs=U.useCallback(async oe=>{const ge=await Ut.connectWorkflow(oe);return t(ve=>ve&&{...ve,workflows:[...ve.workflows.filter(Se=>Se.path!==ge.path),ge]}),(xt.current??(xt.current=new Set)).add(ge.path),ge},[]),ys=U.useCallback(async oe=>{const ge=await Ut.scanWorkflows(oe),ve=await It(),Se=xt.current??(xt.current=new Set);for(const Me of ve)Se.add(Me.path);return ge},[It]),Ds=U.useCallback(()=>Ut.listHarnesses(),[]),ai=U.useCallback(async(oe,ge)=>{const ve=await Ut.bindWorkflow(oe,ge);t(Se=>Se&&{...Se,sessions:Se.sessions.map(Me=>Me.id===ve.id?ve:Me)})},[]),Is=U.useCallback(async oe=>{const ge=await Ut.updateSettings(oe);return r(ge),oe.telemetryOptIn!==void 0&&t(ve=>ve&&{...ve,telemetryOptIn:ge.telemetryOptIn}),oe.productAnalyticsOptIn!==void 0&&t(ve=>ve&&{...ve,productAnalyticsOptIn:ge.productAnalyticsOptIn!==!1}),ge},[]),$s=U.useCallback(async(oe,ge)=>{try{await Ut.runMacro(oe,ge)}catch(ve){j(qs(ve instanceof ji&&ve.reason?ve.reason:ve.message))}},[]),st=U.useCallback(oe=>{const ge=L.current.get(oe);if(ge)return ge;const ve=(async()=>{j(qs("Deploying…","info"));const Se=jd(oe),Me=Bw(c.current.find(yt=>yt.path===oe)),Je=performance.now();Os("agent.deploy_started",{workflow_slug:Se,...Me});let _t=null,Rt=null,Tt=!1;try{const yt=await Ut.deploy(oe,At=>{At.phase==="linking"?(_t="linking",Z(oe,{phase:"linking"}),j(qs(`Deploying — creating the agent "${At.name}" on Sapiom…`,"info"))):At.phase==="warning"?(Rt=At.message,j(qs(At.message))):At.phase==="building"&&(_t="building",Z(oe,{phase:"building"}),j(qs("Deploying — building on Sapiom…","info")),It())});if(yt.phase==="ready")Z(oe,{phase:"ready"}),Os("agent.deploy_succeeded",{workflow_slug:Se,duration_ms:Math.round(performance.now()-Je),...Me}),Tt=!0,j(Rt?qs(`Deployed to Sapiom. ${Rt}`):qs("Deployed to Sapiom.","success")),ce(At=>{if(!At.has(oe))return At;const _e=new Map(At);return _e.delete(oe),_e}),await It();else if(yt.phase==="error"){const At=_t==="linking"?"Couldn't create the agent":"Deploy failed",_e=yt.hint?`${At}: ${yt.message} (${yt.hint})`:`${At}: ${yt.message}`;Z(oe,{phase:"error",message:_e}),Os("agent.deploy_failed",{workflow_slug:Se,error_kind:Pw(_t,!1),...Me}),Tt=!0,j(qs(_e)),ce(De=>new Map(De).set(oe,_e)),await It()}}catch(yt){const At=yt instanceof ji&&yt.reason?yt.reason:yt.message;Z(oe,{phase:"error",message:At}),Tt||Os("agent.deploy_failed",{workflow_slug:Se,error_kind:Pw(_t,!0),...Me}),j(qs(At)),ce(_e=>new Map(_e).set(oe,At))}finally{ut(),L.current.delete(oe)}})();return L.current.set(oe,ve),ve},[It,ut,Z]),Ge=U.useCallback(async(oe,ge,ve)=>{try{const{executionId:Se}=await Ut.run({definitionId:ge,input:ve});Ke(oe,Se,"prod")}catch(Se){j(qs(Se instanceof ji&&Se.reason?Se.reason:Se.message))}finally{ut()}},[Ke,ut]),ke=U.useCallback(async()=>Ut.startAuth(),[]),Xe=U.useCallback(async()=>{try{await Ut.disconnect()}catch(oe){j(qs(oe instanceof ji&&oe.reason?oe.reason:oe.message))}},[]),Vt=U.useCallback(()=>j(null),[]),Ns=U.useCallback(async(oe,ge)=>{await Ut.injectInput(oe,{text:ge,submit:!0})},[]),gi=U.useCallback((oe,ge="error")=>{j(qs(oe,ge))},[]),Ks=U.useCallback(oe=>V.get(oe)??null,[V]),_i=U.useCallback(oe=>Ut.listDir(oe),[]),Mi=U.useCallback(oe=>Ut.getWorkflowInputContract(oe),[]);return{state:e,loading:f,error:d,errorKind:y,reload:gs,settings:n,bootToken:ao(),selectedWorkflowPath:R,setSelectedWorkflowPath:x,activeSessionId:g,setActiveSessionId:et,history:p,historyLoading:C,loadHistory:gt,createSession:_s,listTemplates:Fe,getTemplate:Ts,getWorkflowInputContract:Mi,sessionRecord:ts,resumeSession:vi,rehydrateSession:ps,resumeFromHistory:Gs,closeSession:ri,connectWorkflow:Zs,scanWorkflows:ys,listHarnesses:Ds,bindWorkflow:ai,updateSettings:Is,runMacro:$s,deploy:st,startProdRun:Ge,runLocal:jt,injectInput:Ns,showToast:gi,lastDeployErrorFor:Ks,deployStateByPath:ae,dismissDeployState:oe=>Z(oe,null),pendingWorkspaces:ue,addPendingWorkspace:Ae,removePendingWorkspace:Ie,directActionSettleSeq:$e,listDir:_i,lastMessage:B,runsBySession:Dt,runsByExecution:ee,runIdsBySession:$,selectRun:fs,previewBySession:ie,toast:k,dismissToast:Vt,busySessionIds:F,tasks:te,api:Ut,startAuth:ke,disconnect:Xe}}const Q6=10*6e4,eL=4e3;function Tl(e,t){return t?e.filter(n=>n.status!=="exited"&&(M1(n.boundWorkflowPath??"",t)||n.boundWorkflowPath==null&&M1(n.cwd,t))).sort((n,r)=>n.createdAt.localeCompare(r.createdAt)||n.id.localeCompare(r.id)):[]}const tL=()=>{var Er,nc,Qs,ca,xo,ua,pn,Co,Eo,mn,rc,ko,jo,da,ac,oc,kr,Di,ha,fa,vn;const e=Z6(),t=s6(),[n,r]=U.useState(!1),[o,c]=U.useState(null),f=U.useRef(new Map),l=U.useCallback(async Q=>{const be=f.current.get(Q);try{const Re=await e.getWorkflowInputContract(Q);return Re.status==="unavailable"&&be?be:Re}catch(Re){if(be)return be;throw Re}},[e.getWorkflowInputContract]),[d,m]=U.useState(!1),[y,v]=U.useState(null),S=U.useRef(null),w=U.useRef(null),R=U.useRef(i6()),x=U.useRef(!1),g=U.useRef(null),[b,p]=U.useState(null),[_,k]=U.useState(null),[j,C]=U.useState(!1),[T,A]=U.useState(()=>{const Q=dn().rightTab;return Q==="canvas"||Q==="steps"||Q==="code"?Q:"canvas"}),[M,L]=U.useState(T==="code"),[B,q]=U.useState(null),[F,J]=U.useState(!1),[te,W]=U.useState(!1),[se,ee]=U.useState(()=>dn().sessionNames??{}),H=(Q,be)=>{ee(Re=>{const Qe={...Re},$t=be.trim();return $t?Qe[Q]=$t:delete Qe[Q],Vn({sessionNames:Qe}),Qe})},$=U.useRef(new Map),O=U.useRef([]),P=U.useCallback(Q=>{const be=$.current.get(Q);if(be)return window.clearTimeout(be.timer),window.clearTimeout(be.hintTimer),$.current.delete(Q),be},[]),z=U.useCallback(Q=>{const be=$.current.get(Q);if(!be)return;const Re=O.current.find(Qe=>Qe.id===Q);Re&&(Re.ready?(P(Q),e.injectInput(Q,be.prompt).catch(()=>e.showToast(be.failMessage))):Re.status==="exited"&&(P(Q),e.showToast(be.failMessage)))},[P,e.injectInput,e.showToast]),I=U.useCallback((Q,be,Re)=>{P(Q);const Qe=window.setTimeout(()=>{P(Q)&&e.showToast(Re)},Q6),$t=window.setTimeout(()=>{$.current.has(Q)&&e.showToast("Sign in to Claude in the terminal — your prompt sends automatically once you're signed in.")},eL);$.current.set(Q,{prompt:be,failMessage:Re,timer:Qe,hintTimer:$t}),z(Q)},[P,e.showToast,z]);U.useEffect(()=>{var Q;if(O.current=((Q=e.state)==null?void 0:Q.sessions)??[],$.current.size!==0)for(const be of[...$.current.keys()])z(be)},[(Er=e.state)==null?void 0:Er.sessions,z]);const[G,ie]=U.useState(()=>$v()||(dn().railCollapsed??!1)),[X,V]=U.useState(()=>$v()||(dn().rightCollapsed??!1)),[ce,ae]=U.useState(!1),Y=N6(),Z=R6(),{widths:ue,canvasResizing:we,railResizing:Ae,startRailDrag:Ie,startCanvasDrag:$e,resetRail:ct,resetCanvas:ut}=O6(),[mt,et]=U.useState(!1),vt=U.useRef(!1),tt=U.useRef(null),Ke=U.useRef(null),Ot=U.useRef(!1),jt=U.useRef(!1),fs=U.useRef(null),Dt=U.useRef(null),xt=U.useCallback(Q=>{Q&&!vt.current&&Q.style.setProperty("--rp-w",`${Q.offsetWidth}px`)},[]),gs=U.useCallback(Q=>{var Re;if((Re=Dt.current)==null||Re.disconnect(),fs.current=Q,!Q){Dt.current=null;return}const be=new ResizeObserver(()=>{jt.current||xt(Q)});be.observe(Q),Dt.current=be},[xt]);vt.current=X,jt.current=mt,U.useLayoutEffect(()=>{if(Y)return;et(!0);const Q=window.setTimeout(()=>{et(!1),xt(fs.current)},260);return()=>window.clearTimeout(Q)},[X,Y,xt]),U.useEffect(()=>{const Q=be=>{var Qe;const Re=be.key.toLowerCase();if((be.metaKey||be.ctrlKey)&&(Re==="k"||Re==="p")){be.preventDefault(),r(!0);return}if((be.metaKey||be.ctrlKey)&&/^[1-9]$/.test(be.key)){const is=Tl(((Qe=e.state)==null?void 0:Qe.sessions)??[],y)[Number(be.key)-1];is&&(be.preventDefault(),m(!1),q(null),J(!1),W(!1),e.setActiveSessionId(is.id))}};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[(nc=e.state)==null?void 0:nc.sessions,y]);const It=i5({settingsRoot:(Qs=e.settings)==null?void 0:Qs.projectRoot,defaultProjectRoot:(ca=e.state)==null?void 0:ca.defaultProjectRoot,launchDir:(xo=e.state)==null?void 0:xo.launchDir}),gt=async Q=>{await e.updateSettings({projectRoot:Q})};U.useEffect(()=>{var be;if(!n||!e.state)return;const Q=YC(e.state.sessions,((be=e.settings)==null?void 0:be.recentDirs)??[],e.activeSessionId);Q.length>0&&e.loadHistory(Q)},[n]);const _s=U.useRef(!1);U.useEffect(()=>{var be;if(_s.current||!e.state)return;_s.current=!0;const Q=e.state.sessions.find(Re=>Re.id===e.activeSessionId);v(ro(Q)??((be=e.state.workflows[0])==null?void 0:be.path)??null)},[e.state,e.activeSessionId]);const Fe=e.state;U.useEffect(()=>{Fe&&w6(Fe)},[Fe,Fe==null?void 0:Fe.authenticated,Fe==null?void 0:Fe.userId,Fe==null?void 0:Fe.tenantId,Fe==null?void 0:Fe.consentSource,Fe==null?void 0:Fe.productAnalyticsOptIn,Fe==null?void 0:Fe.version]),U.useEffect(()=>{if(!Fe)return;const Q=Fe.sessions.find(Re=>Re.id===e.activeSessionId),be={firstRun:Fe.firstRun===!0,settingsOpen:j,templatesOpen:F,hasLiveSession:Fe.sessions.some(Re=>Re.status!=="exited"),inspectingDeadSession:(Q==null?void 0:Q.status)==="exited",rightTab:T};o4(be),x6((Q==null?void 0:Q.harness)??null)},[Fe,e.activeSessionId,j,F,T]);const Ts=U.useRef(Y);U.useEffect(()=>{Ts.current!==Y&&(Ts.current=Y,ie(Y),V(Y))},[Y]),U.useEffect(()=>{Y||Vn({railCollapsed:G,rightCollapsed:X})},[G,X,Y]),U.useEffect(()=>{Vn({rightTab:T})},[T]);const ts=Z.record,vi=e.activeSessionId,ps=y!=null&&Tl(((ua=e.state)==null?void 0:ua.sessions)??[],y).length>0,Gs=U.useRef(!1);U.useEffect(()=>{if(Gs.current){Gs.current=!1;return}F?ts({kind:"templates"}):B?ts({kind:"review",summary:B}):d?ts({kind:"composer"}):vi&&(y==null||ps)?ts({kind:"session",sessionId:vi,agentPath:y}):y&&ts({kind:"agent",agentPath:y})},[ts,F,B,d,vi,y,ps]);const ri=e.setActiveSessionId,Zs=U.useCallback(Q=>{Q&&(Gs.current=!0,W(!1),J(Q.kind==="templates"),m(Q.kind==="composer"),q(Q.kind==="review"?Q.summary:null),Q.kind==="session"?(v(Q.agentPath),ri(Q.sessionId)):Q.kind==="agent"&&v(Q.agentPath))},[ri]),ys=((pn=e.state)==null?void 0:pn.sessions.find(Q=>Q.id===e.activeSessionId&&Q.status==="exited"))??null,Ds=ys!=null&&ys.agentSessionId?(Co=e.history.find(Q=>Q.agentSessionId===ys.agentSessionId))==null?void 0:Co.resumeMode:"rehydrate",ai=(ys==null?void 0:ys.agentSessionId)!=null&&Ds===void 0?ys.cwd:null,Is=e.loadHistory;U.useEffect(()=>{ai&&Is([ai])},[ai,Is]);const $s=U.useRef(new Map);if(U.useEffect(()=>{for(const Q of e.tasks){if(Q.macroId!=="describe")continue;$s.current.get(Q.id)==="running"&&Q.status!=="running"&&e.showToast(Q.status==="failed"?"Couldn't generate descriptions — check the agent terminal for details.":"Describe run finished — the canvas updates if the agent changed the source.",Q.status==="failed"?"error":"success"),$s.current.set(Q.id,Q.status)}},[e.tasks,e.showToast]),U.useEffect(()=>{const Q=xr();if(Q!=null&&Q.onDeepLink)return Q.onDeepLink(be=>{var Re;return(Re=S.current)==null?void 0:Re.call(S,be)})},[]),U.useEffect(()=>{var be;if(e.loading)return;const Q=R.current;!Q||x.current||(x.current=!0,(be=S.current)==null||be.call(S,Q))},[e.loading]),U.useEffect(()=>{var be;const Q=g.current;Q&&((be=w.current)!=null&&be.call(w,Q))&&(g.current=null)},[(Eo=e.state)==null?void 0:Eo.workflows]),e.loading)return h.jsx("div",{className:"app-status",children:"Loading Agent Studio…"});if(e.error||!e.state){const Q=t6({online:t,error:e.errorKind});return h.jsx(y5,{status:Q==="online"?"error":Q,onRetry:e.reload,detail:e.error,onStartAuth:Q==="auth"?e.startAuth:void 0})}const{state:st}=e,Ge=st.sessions.find(Q=>Q.id===e.activeSessionId)??null,ke=ro(Ge),Xe=st.workflows.find(Q=>Q.path===ke)??null,Vt=st.workflows.find(Q=>Q.path===y)??null,Ns=Tl(st.sessions,y),gi=B!=null,Ks=!gi&&(Ge==null?void 0:Ge.status)==="exited",_i=!gi&&!Ks&&!d&&Vt!=null&&Ns.length===0,Mi=!gi&&!Ks&&!d&&!_i&&Ge!=null&&Ge.status!=="exited",oe=!gi&&!Ks&&(d||!_i&&!Mi),ge=d&&Ge!=null&&Ge.status!=="exited",ve=_i?null:Xe,Se=_i?(Vt==null?void 0:Vt.name)??null:null,Me=`${e.activeSessionId??""}::${(ve==null?void 0:ve.path)??""}`,Je=()=>{Ke.current=e.activeSessionId??null,Ot.current=e.activeSessionId==null,V(!1)},_t=ve?yo(ve,e.lastDeployErrorFor(ve.path)):null,Rt=e.activeSessionId?e.runsBySession.get(e.activeSessionId)??null:null,Tt=Dw(Rt,ke)?Rt:null,yt=e.activeSessionId?(e.runIdsBySession.get(e.activeSessionId)??[]).map(Q=>e.runsByExecution.get(Q)).filter(Q=>Q!==void 0).filter(Q=>Dw(Q,ke)):[],At=(Tt==null?void 0:Tt.run.status)==="running"?Tt.target:null,_e=()=>{Y&&ie(!0)},De=async(Q,be)=>{m(!1),q(null),W(!1),v(Q),e.addPendingWorkspace(Q),_e();try{const Re=await e.createSession({cwd:Q,harness:be});return Ql("session.created"),Os("session.started",{harness_kind:be,origin:"user"}),Re}catch(Re){throw e.removePendingWorkspace(Q),Re}},Oe=async(Q,be)=>{await De(Q,be)},Ze=async(Q,be,Re)=>{const Qe=await De(Q,be),$t=`Scaffold a new Sapiom agent project in this directory: ${Tv(Q,"default")}, then run npm install, read AGENTS.md, and use the sapiom-agent-authoring skill to`,is=Re==null?void 0:Re.trim();I(Qe.id,is?`${$t} build this:
|
|
489
|
-
|
|
490
|
-
${is}`:`${$t} define the first agent.`,"Couldn't send the scaffold prompt. Ask the coding agent to call sapiom_dev_agents_scaffold.")},ot=Q=>{(async()=>{const be=Tl(st.sessions,Q.path)[0],Re=(be==null?void 0:be.cwd)??Q.path;try{const Qe=await De(Re,"claude-code");await e.bindWorkflow(Qe.id,Q.path),v(Q.path)}catch(Qe){e.showToast(Qe.message||"Couldn't start the session.")}})()},bs=Q=>{var Re;const be=((Re=st.sessions.find(Qe=>Qe.id===Q))==null?void 0:Re.cwd)??".";I(Q,`Scaffold a new Sapiom agent project in this directory: ${Tv(be,"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.")},Ve=async(Q,be,Re="template_gallery")=>{const Qe=await De(Q,"claude-code");Os("agent.template_cloned",{template_slug:be.id,template_id:be.id,surface:Re}),I(Qe.id,c5(be,Q),be.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.")},He=Q=>{const be=new Set;for(const Re of st.sessions){const Qe=br(Re.cwd);Qe&&be.add(Qe)}for(const Re of st.workflows){const Qe=br(Re.path);Qe&&be.add(Qe)}return GC(r5(Q,be),It||null)},lt=(Q,be)=>{const Re=He(Q.trim()?s5(Q):dg);if(!Re){e.showToast("Set a project folder first — use the + to open one.");return}V(!0),Ze(Re,be,Q.trim()||void 0)},ss=Q=>{const be=He(Q.id);if(!be){e.showToast("Set a project folder first — use the + to open one.");return}V(!0),Ve(be,Q,"welcome")},Jt=async Q=>{const be=await e.scanWorkflows(Q);return e.showToast(be.length===0?"No agent projects found under this folder.":be.length===1?"Found 1 agent project.":`Found ${be.length} agent projects.`,be.length===0?"info":"success"),be.length},sn=Q=>{m(!1),q(null),J(!1),W(!1),_e();const be=st.sessions.find(Re=>Re.id===Q);be&&v(ro(be)??be.cwd),e.setActiveSessionId(Q)},So=Q=>{m(!1),q(null),J(!1),W(!1),e.setActiveSessionId(Q)},nn=Q=>{m(!1),q(Q),J(!1),W(!1),_e()},la=Q=>{var Re;const be=(Re=e.settings)==null?void 0:Re.editor;e.showToast(`Opening in ${Tw(be)}… Pick a different editor in Settings.`,"info"),window.location.href=B$(be,Q)},Oi=Q=>{var Qe;m(!1),q(null),J(!1),W(!1),v(Q),_e();const be=Tl(st.sessions,Q),Re=be.some($t=>$t.id===e.activeSessionId)?e.activeSessionId:((Qe=be[be.length-1])==null?void 0:Qe.id)??null;Re!==e.activeSessionId&&e.setActiveSessionId(Re)};w.current=Q=>{const be=st.workflows.find(Re=>Re.definitionId!=null&&String(Re.definitionId)===Q);return be?(Oi(be.path),!0):!1},S.current=Q=>{var be;if(Q.kind==="template"){k(Q.templateId),J(!0),W(!1);return}(be=w.current)!=null&&be.call(w,Q.definitionId)||p(Q)};const oi=async Q=>{var Re;p(null);const be=He(((Re=Q.slug)==null?void 0:Re.trim())||`agent-${Q.definitionId}`);if(!be){e.showToast("Set a project folder first — use the + to open one.");return}g.current=Q.definitionId,V(!0);try{const Qe=await De(be,"claude-code");I(Qe.id,u5(Q.definitionId,be),"Couldn't send the clone prompt. Ask the coding agent to run sapiom_dev_agents_clone.")}catch(Qe){g.current=null,e.showToast(Qe.message||"Couldn't start a session to clone the agent.")}},Cr=async Q=>{_e();const be=st.sessions.filter(Ss=>Ss.status!=="exited"),Re=Ss=>Ss.boundWorkflowPath===Q||ug(Ss.cwd,Q),Qe=be.find(Ss=>Ss.id===e.activeSessionId),$t=Qe&&Re(Qe)?Qe:be.filter(Re).sort((Ss,Gn)=>Gn.cwd.length-Ss.cwd.length||Gn.createdAt.localeCompare(Ss.createdAt))[0];let is;if($t)m(!1),q(null),W(!1),$t.id!==e.activeSessionId&&e.setActiveSessionId($t.id),is=$t.id;else try{is=(await De(Q,"claude-code")).id}catch(Ss){return e.showToast(Ss.message||"Couldn't start a session in this folder."),null}return await e.bindWorkflow(is,Q),v(Q),is},sc=(Q,be)=>{(async()=>{const Re=e2(be.id);((Re==="deploy"||Re==="run-local")&&Q!=null||Re==="prod-run"&&(Q==null?void 0:Q.definitionId)!=null&&Id(Q))&&(A("steps"),V(!1));let $t=e.activeSessionId;if(Q&&($t=await Cr(Q.path)??$t),be.action.kind==="open-url"){window.open(B5(be.action.url,Q),"_blank","noopener,noreferrer");return}if($t){if(Re!==null){if(Re==="deploy")Q?e.deploy(Q.path):e.showToast("Select an agent first.");else if(Re==="prod-run")if((Q==null?void 0:Q.definitionId)!=null&&Id(Q))e.startProdRun($t,String(Q.definitionId));else{const is=Q?e.lastDeployErrorFor(Q.path):null,Ss=Q?yo(Q,is):"draft";e.showToast(Ss==="failed"?"Last deploy failed — retry Deploy.":Ss==="building"?"The cloud build is still in progress.":Ss==="linked"?"No ready deployment yet — deploy it first.":"This agent isn't deployed yet — deploy it first.")}else Re==="run-local"&&(Q?e.runLocal($t,Q.path):e.showToast("Select an agent first."));return}e.runMacro(be.id,{harnessSessionId:$t,workflowPath:Q==null?void 0:Q.path})}})()},wo=Q=>{const be=o;be&&(c(null),A("steps"),V(!1),(async()=>{const Re=await Cr(be.workflow.path)??e.activeSessionId;if(Re)if(be.target==="prod"){if(be.workflow.definitionId==null||!Id(be.workflow)){e.showToast("This agent needs a ready cloud deployment first.");return}await e.startProdRun(Re,String(be.workflow.definitionId),Q)}else await e.runLocal(Re,be.workflow.path,Q)})())},ic=Q=>{(async()=>{const be=await Cr(Q.path)??e.activeSessionId;be&&e.runMacro("describe",{harnessSessionId:be,workflowPath:Q.path,subject:C6(Q)})})()};return h.jsxs("div",{className:"app-shell","data-rail-collapsed":G||void 0,children:[Y&&!G&&h.jsx("div",{className:"shell-scrim","data-testid":"rail-drawer-scrim","aria-hidden":"true",onClick:()=>ie(!0)}),(!Y||!G)&&h.jsx("div",{className:"rail-slot"+(Ae?" is-resizing":"")+(!Y&&G?" is-collapsed":""),inert:!Y&&G?!0:void 0,style:Y?void 0:{width:G?0:ue.rail},children:h.jsx(X$,{projectRoot:It||null,onSaveProjectRoot:gt,width:ue.rail,minWidth:xg,workflows:st.workflows,sessions:st.sessions,pendingWorkspaces:e.pendingWorkspaces,activeSessionId:e.activeSessionId,focusedAgentPath:y,onFocusAgent:Oi,onOpenPalette:()=>r(!0),onConnect:async Q=>{await e.connectWorkflow(Q)},onCollapse:()=>ie(!0),canGoBack:Z.canGoBack,canGoForward:Z.canGoForward,onGoBack:()=>Zs(Z.goBack()),onGoForward:()=>Zs(Z.goForward()),onSelectSession:sn,overviewSelected:te,onSelectOverview:()=>{W(!0),m(!1),q(null),J(!1),_e()},onNewSession:()=>{m(!0),J(!1),W(!1)},onReviewSummary:nn,history:e.history,historyLoading:e.historyLoading,onOpenHistory:Q=>void e.loadHistory(Q),recentDirs:((mn=e.settings)==null?void 0:mn.recentDirs)??[],launchDir:st.launchDir??null,listDir:e.listDir,onCreateSession:Oe,listHarnesses:e.listHarnesses,onScaffoldSession:Ze,onScaffoldInSession:bs,onBrowseTemplates:()=>{J(!0),W(!1)},templatesActive:F,onScanWorkflows:Jt,onToast:e.showToast,telemetryOptIn:((rc=e.settings)==null?void 0:rc.telemetryOptIn)??st.telemetryOptIn,consentSource:st.consentSource,consentEnvReason:st.consentEnvReason,authenticated:st.authenticated,organizationName:st.organizationName,onToggleTelemetry:async Q=>{await e.updateSettings({telemetryOptIn:Q})},productAnalyticsOptIn:st.productAnalyticsOptIn,onToggleProductAnalytics:async Q=>{await e.updateSettings({productAnalyticsOptIn:Q})},rollingSummary:((ko=e.settings)==null?void 0:ko.rollingSummary)===!0,onToggleRollingSummary:async Q=>{await e.updateSettings({rollingSummary:Q})},editor:Nh((jo=e.settings)==null?void 0:jo.editor),onSelectEditor:async Q=>{await e.updateSettings({editor:Q})},onStartAuth:e.startAuth,onDisconnect:e.disconnect,settingsOpen:j,onSetSettingsOpen:C})}),!G&&!Y&&h.jsx("div",{className:"pane-resize-handle pane-resize-handle-rail",style:{left:ue.rail},onPointerDown:Ie,onDoubleClick:ct,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(b5,{}),st.consentSource==="default-silent"&&!((da=e.settings)!=null&&da.telemetryNoticeDismissed)&&h.jsx(CD,{onDismiss:()=>{e.updateSettings({telemetryNoticeDismissed:!0})},onOpenSettings:()=>C(!0)}),h.jsxs("div",{className:"app"+(F?" is-browsing":"")+(!F&&!Y&&!oe?" canvas-animated":"")+(mt?" canvas-sliding":"")+(we?" canvas-dragging":""),style:{gridTemplateColumns:F||Y||oe?"minmax(0, 1fr)":`minmax(${ec}px, 1fr) ${X?ue.canvas==null?"0fr":"0px":ue.canvas==null?"1fr":`${ue.canvas}px`}`},children:[F&&h.jsx(PD,{projectRoot:It||null,recentDirs:((ac=e.settings)==null?void 0:ac.recentDirs)??[],listDir:e.listDir,onExit:()=>J(!1),onUse:Ve,listTemplates:e.listTemplates,getTemplate:e.getTemplate,openTemplateId:_}),h.jsxs("div",{className:"center-pane",children:[h.jsx(L5,{openedAgentName:Se,reviewTitle:B?B.title:null,composing:oe,onBack:ge?()=>m(!1):null,activeSession:Mi||Ks?Ge:null,sessionName:Ge?dh(Ge,st.sessions,se):null,onRenameSession:H,boundWorkflowName:(Xe==null?void 0:Xe.name)??null,sessions:Mi?Ns:[],onSelectSession:So,labelOf:Q=>{const be=dh(Q,st.sessions,se),Re=br(Q.cwd),Qe=be.startsWith(`${Re} `)?be.slice(Re.length+1):"";if(!(be===Re||/^\d+$/.test(Qe))||!Vt)return be;const is=Ns.findIndex(Ss=>Ss.id===Q.id);return is>0?`${Vt.name} ${is+1}`:Vt.name},busy:Ge!=null&&e.busySessionIds.has(Ge.id),onCloseSession:Q=>void e.closeSession(Q),onOpenInEditor:la,editorLabel:Tw((oc=e.settings)==null?void 0:oc.editor),onToast:e.showToast,onExpandRail:G?()=>ie(!1):null,onExpandRight:X?Je:null,onNewSession:()=>m(!0),actions:Mi&&Ge&&Xe?h.jsx(_D,{workflow:Xe,activeSessionId:e.activeSessionId,sessionReady:Ge.ready===!0&&Ge.status!=="exited",macros:st.macros,onRunMacro:Q=>sc(Xe,Q),onRequestRun:(Q,be)=>c({workflow:Xe,target:Q,returnFocus:be}),preview:e.previewBySession.get(Ge.id)??null,lastDeployError:e.lastDeployErrorFor(Xe.path),authenticated:st.authenticated,directActionSettleSeq:e.directActionSettleSeq,runningTarget:At}):null}),h.jsx("div",{className:"terminal-slot",children:gi&&B?h.jsx(O5,{summary:B,loadRecord:e.sessionRecord,onStart:()=>{const Q=B;q(null),e.resumeFromHistory(Q)},onClose:()=>q(null)}):Ks&&Ge?h.jsx(M5,{session:Ge,resumeMode:Ds,loadRecord:e.sessionRecord,onResume:()=>void e.resumeSession(Ge.id),onContinue:()=>void e.rehydrateSession({cwd:Ge.cwd,harness:Ge.harness,from:Ge.id}),onClose:()=>void e.closeSession(Ge.id)}):_i&&Vt?h.jsx(Zi,{className:"terminal-empty",testId:"open-agent-empty",icon:"Radio",title:`No running session for ${Vt.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:()=>ot(Vt),children:[h.jsx(de,{name:"Plus",size:14})," Start session"]})}):Mi&&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(t$,{sessionId:e.activeSessionId,token:e.bootToken,cwd:(Ge==null?void 0:Ge.cwd)??null})})}):h.jsx(k$,{firstRun:st.firstRun===!0,onSubmitIdea:lt,onUseTemplate:ss,onBrowseTemplates:()=>J(!0),listHarnesses:e.listHarnesses,listTemplates:e.listTemplates,telemetryOptIn:((kr=e.settings)==null?void 0:kr.telemetryOptIn)??st.telemetryOptIn,onToggleTelemetry:async Q=>{await e.updateSettings({telemetryOptIn:Q})},recentDirs:((Di=e.settings)==null?void 0:Di.recentDirs)??[],projectRoot:It||null,listDir:e.listDir,onConnect:async Q=>{await e.connectWorkflow(Q)},onScan:Jt,onScaffold:Ze,onSaveProjectRoot:gt})})]}),!X&&!Y&&!oe&&h.jsx("div",{className:"pane-resize-handle pane-resize-handle-canvas",style:{right:ue.canvas==null?"50%":`min(${ue.canvas}px, calc(100% - ${ec}px))`},onPointerDown:$e,onDoubleClick:ut,role:"separator","aria-orientation":"vertical","aria-label":"Resize canvas pane","data-testid":"resize-handle-canvas"}),Y&&!X&&h.jsx("div",{className:"shell-scrim","data-testid":"right-sheet-scrim","aria-hidden":"true",onClick:()=>V(!0)}),h.jsxs("div",{ref:gs,className:"right-pane"+(X||oe?" is-collapsed":""),children:[h.jsxs("div",{className:"right-pane-tabs",role:"tablist","aria-label":"Right pane",children:[h.jsxs("button",{role:"tab","aria-selected":T==="canvas",className:"right-pane-tab"+(T==="canvas"?" is-active":""),onClick:()=>A("canvas"),"data-testid":"right-tab-canvas",children:[h.jsx(de,{name:"Workflow",size:14}),"Canvas"]}),h.jsxs("button",{role:"tab","aria-selected":T==="steps",className:"right-pane-tab"+(T==="steps"?" is-active":""),onClick:()=>A("steps"),"data-testid":"right-tab-steps",children:[h.jsx(de,{name:"List",size:14}),"Steps"]}),h.jsxs("button",{role:"tab","aria-selected":T==="code",className:"right-pane-tab"+(T==="code"?" is-active":""),onClick:()=>{A("code"),L(!0)},"data-testid":"right-tab-code",children:[h.jsx(de,{name:"Code",size:14}),"Code"]}),h.jsxs("div",{className:"right-pane-corner",children:[T==="canvas"&&(ve==null?void 0:ve.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":_t??void 0,href:yh(ve.definitionId),target:"_blank",rel:"noreferrer","aria-label":`${_t} — open in the Sapiom dashboard`,"data-tooltip":"Open this agent in the Sapiom dashboard",children:[h.jsx(de,{name:"Cloud",size:12}),_t==="ready"?"deployed":_t==="building"?"building":_t==="failed"?"deploy failed":"linked"]}),(T==="canvas"||T==="steps")&&h.jsx("button",{className:"theme-toggle","data-testid":"canvas-expand",hidden:ce,"aria-label":T==="steps"?"Open Focus mode":"Expand canvas",title:T==="steps"?"Open Focus mode":"Expand canvas",onClick:()=>ae(Q=>!Q),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:()=>V(!0),children:h.jsx(de,{name:"PanelRightClose",size:15})})]})]}),h.jsx("div",{className:"right-pane-panel"+(T==="canvas"||T==="steps"?"":" is-hidden"),"data-testid":"right-panel-canvas",children:h.jsx(d4,{sessionId:e.activeSessionId,lastMessage:e.lastMessage,boundWorkflow:ve,noSessionAgent:Se,overviewActive:oe,sessionExited:Ks,onCanvasState:Q=>{var Qe;if(Y)return;const be=((Qe=st.sessions.find($t=>$t.id===e.activeSessionId))==null?void 0:Qe.status)==="exited";if(Q||be){tt.current=null,V(!1);return}if(Ot.current){Ot.current=!1,Ke.current=e.activeSessionId??null;return}const Re=Ke.current;Re!=null&&Re===e.activeSessionId||tt.current!==Me&&(tt.current=Me,V(!0))},onGraphChange:(Q,be)=>{const Re=pD(be);Re&&f.current.set(Q,Re)},expanded:ce,onToggleExpanded:()=>ae(Q=>!Q),macros:st.macros,tasks:e.tasks,surface:T==="steps"?"steps":"board",onOpenSteps:()=>A("steps"),run:(Tt==null?void 0:Tt.run)??null,runTarget:(Tt==null?void 0:Tt.target)??null,runs:yt,onSelectRun:Q=>{e.activeSessionId&&e.selectRun(e.activeSessionId,Q)},preview:e.activeSessionId?e.previewBySession.get(e.activeSessionId)??null:null,deployState:ve?e.deployStateByPath.get(ve.path)??null:null,onDismissDeploy:()=>{ve&&e.dismissDeployState(ve.path)},onOpenCode:()=>{A("code"),L(!0)},workflows:st.workflows,onOpenWorkflow:Q=>void Cr(Q),onRunMacro:Q=>sc(Xe,Q),onInjectPrompt:Q=>{e.activeSessionId&&e.injectInput(e.activeSessionId,Q)},onDescribeWorkflow:ic})}),(T==="code"||M)&&h.jsx("div",{className:"right-pane-panel"+(T==="code"?"":" is-hidden"),"data-testid":"right-panel-code",children:h.jsx(k4,{boundWorkflow:ve,noSessionAgent:Se,agentsBaseUrl:st.agentsBaseUrl,lastDeployError:ve?e.lastDeployErrorFor(ve.path):null})})]})]})]}),te&&h.jsx(j$,{firstRun:st.firstRun===!0,appVersion:((ha=xr())==null?void 0:ha.appVersion)||"0.8.0",recentDirs:((fa=e.settings)==null?void 0:fa.recentDirs)??[],projectRoot:It||null,listDir:e.listDir,onConnect:async Q=>{await e.connectWorkflow(Q),W(!1)},onScan:Jt,onBrowseTemplates:()=>{W(!1),J(!0)},onDismiss:()=>W(!1)}),n&&h.jsx(g5,{sessions:st.sessions,workflows:st.workflows,recentDirs:((vn=e.settings)==null?void 0:vn.recentDirs)??[],history:e.history,sessionNames:se,activeSessionId:e.activeSessionId,listDir:e.listDir,listTemplates:e.listTemplates,onSelectSession:sn,onReviewSummary:nn,onOpenPath:Q=>void Oe(Q,"claude-code"),onOpenTemplate:Q=>{k(Q),J(!0),W(!1)},actions:[{id:"browse-templates",label:"Browse templates",meta:"Gallery and starters",icon:"LayoutTemplate",run:()=>{J(!0),W(!1)}},{id:"toggle-theme",label:"Toggle theme",meta:"Light and dark",icon:"Sun",run:qw},{id:"toggle-rail",label:G?"Show workspace panel":"Hide workspace panel",meta:"Left pane",icon:"Menu",run:()=>ie(Q=>!Q)},{id:"toggle-right",label:X?"Show canvas panel":"Hide canvas panel",meta:"Right pane",icon:X?"PanelRightOpen":"PanelRightClose",run:()=>V(Q=>!Q)},...Ge?[{id:"new-session-here",label:"New session in this folder",meta:Ge.cwd,icon:"Plus",run:()=>void Oe(Ge.cwd,"claude-code")}]:[]],onClose:()=>r(!1)}),b&&h.jsx(n6,{agentLabel:b.slug?`“${b.slug}”`:`Agent ${b.definitionId}`,onCancel:()=>p(null),onConfirm:()=>void oi(b)}),o&&h.jsx(xD,{workflow:o.workflow,target:o.target,loadContract:l,returnFocus:o.returnFocus,onClose:()=>c(null),onRun:wo}),e.toast&&h.jsx(r$,{message:e.toast.message,tone:e.toast.tone,onDismiss:e.dismissToast}),h.jsx(a$,{})]})};function sL(e=document.documentElement,t=window){const n=c=>{e.dataset.windowFocused=c?"true":"false"};n(t.document.hasFocus());const r=()=>n(!0),o=()=>n(!1);return t.addEventListener("focus",r),t.addEventListener("blur",o),()=>{t.removeEventListener("focus",r),t.removeEventListener("blur",o)}}function iL(e=typeof window>"u"?"":window.location.search){return new URLSearchParams(e).get("frame")==="macos"?"macos":"web"}document.documentElement.dataset.windowFrame=iL();sL();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()});Yk.createRoot(document.getElementById("root")).render(h.jsx(U.StrictMode,{children:h.jsx(tL,{})}));
|